Search:
Forum
General C++ Programming
Is adding an element to a list thread-sa
Is adding an element to a list thread-safe?
Feb 18, 2010 at 10:40pm UTC
xyzt
(24)
Hi,
I have a class that has a std::list member. I have a member function that adds a new element to this list. I wonder if pushing back an element to a std::list is thread-safe of should I use mutexes to make the operation thread-safe ?
Thanks.
Feb 18, 2010 at 10:42pm UTC
Disch
(13742)
It is not thread safe. Only atomic operations are threadsafe.
Use mutexes.
Feb 19, 2010 at 2:45am UTC
jsmith
(5804)
(additional info: no STL container is thread-safe).
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs