"Sriram Rajagopalan" <> wrote in message news:<cmveo6$ogs$>...
> Hi,
>
> Are STL queues thread safe in the scenario below:
>
> I have 2 threads, one pushing to the rear end of the STL queue.. then
> posting a semaphore- The other thread waits for the semaphore and would
> access the front of the queue. The semaphore is initialized to 0.
Please be more specific:
What are you using as semaphore?
>
> Is there a possiblity of race condition in the above scenario?
>
> Thanks,
> Sriram.
C++ does not deal with threads, currently there are many on-going
discussions in c.l.c++.m.
By this nothing of the STL is thread-safe.
If you properly control the access to the queue with a semaphore
then yes, it is thread safe.
regards,
Stephan Brönnimann
Open source rating and billing engine for communication networks.