locked
concurrent_queue, how unsafe is 'unsafe_size()' in a multi-threaded environment? RRS feed

  • Question

  • Hi,

    I know that the docs says that this function is unsafe but, I am curious how unsafe is it? Here is what I mean:

    Suppose at the same time one thread is doing a push and another one is using unsafe_size() function. If the only two possible results are either the old size (before the push) or the new size (after the push), it is OK for what I want to do. However, if there is a chance to get an undefined result (a totally wrong number) then I need to create a different mechanism to get the size of this container.

    Thanks,

    G.

    Tuesday, April 9, 2013 3:24 PM