Boost logo

Boost Users :

From: Igor R (boost.lists_at_[hidden])
Date: 2008-07-11 11:31:31


Even if the element were returned by value, the following code would
suffer from the race condition:

element = my_conatiner.front();
// here -- the front element might already have been popped here by
another thread!
my_container.pop();

or:

if (!my_container.empty())
{
  // the container might already be empty here!
  element = my_container.front();
}

2008/7/11, Khandelwal, Amit <amit.khandelwal_at_[hidden]>:
> Agreed. I didn't realize that I had typed return by reference. My bad.
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net