N
nicolas.michel.lava
Hi there,
I have some trouble using STL containers.
I'm working on a multithreaded (pthread) application making heavy usage
of STL containers. All accesses to containers are made in locked
sections (using mutexes). But sometimes it happens that the application
crashes on container operations. The 2 last crashes are :
* calling push_back on a stl::list object (the backtrace show the last
call was in stl::list::insert);
* accessing an iterator in a list.
I'm absolutely sure that accesses (read and write) are made in locked
sections. That is to say, I'm sure that only one thread is working on a
container at each moment. I can not figure out what's is happening. Is
it possible that allocations failed ? How can iterators be messed up ?
Can anyone give me a hint on what's happening ? Maybe have I
misunderstood something about usage of containers in multithreaded
environment ...
Any help is welcome
Many thanks
Nicolas -
I have some trouble using STL containers.
I'm working on a multithreaded (pthread) application making heavy usage
of STL containers. All accesses to containers are made in locked
sections (using mutexes). But sometimes it happens that the application
crashes on container operations. The 2 last crashes are :
* calling push_back on a stl::list object (the backtrace show the last
call was in stl::list::insert);
* accessing an iterator in a list.
I'm absolutely sure that accesses (read and write) are made in locked
sections. That is to say, I'm sure that only one thread is working on a
container at each moment. I can not figure out what's is happening. Is
it possible that allocations failed ? How can iterators be messed up ?
Can anyone give me a hint on what's happening ? Maybe have I
misunderstood something about usage of containers in multithreaded
environment ...
Any help is welcome
Many thanks
Nicolas -