Hi,
I am working on a multithreaded application, which also happens to use STL quite heavily.
I'm running into the following problem (I'm sorry I can't post any code, because it is quite large):
list A is accessed in several threads, all of which obtain a lock called lockA prior to reading from or writing to list A. There are other lists (B, C) and the code to access those obtains lockB and lockC respectively. When list B is modified, for example, lockB is obtained, but lockA and lockC aren't.
The problem I'm enountering is that stl's find(A.begin(), A.end(), someelement). It crashes once in a while (I can't reproduce this every time, but it does happen once a week or so, and the program runs 24/7).
GDB reveals that __first element is 0x10 in the
while (__first != __last && !(*__first == __val))
loop, in find's implementation (__first would be initialized to A.begin() and then increment until it reaches __last, which is initialized to A.end()).
Does anyone have any suggestions on how to proceed? What could be the problem? Just to reiterate, I'm sure proper locks are obtained for all accesses (I stared at this code for a better part of a day).
Any and all suggestions are appreciated, and thanks in advance.