| [snip]... | isn't returning an error. Also, if I throw in printf's for debugging | (into thread 3), the problem seems to go away, though for some reason I | have this idea that maybe it just starts happening less often, but that | could be the paranoia talking.
Putting in I/O statements drastically changes the timing of the thread. If it seems to work (or more often) with debugging statements compiled in, it very often indicates a race condition in the code (a subtle bug where mutual exclusion is not properly enforced for a critical section, usually due to programming error). What kind of constructs are you using for synchronization? Semaphores? It can be very difficult to see subtle bugs like race conditions; I suggest letting someone that is allowed to help look over the code. To quote a oft-repeated phrase: "Many eyes make bugs shallow" (or something to that effect!) --E -- Eric Jeschke http://cs.uhh.hawaii.edu/~jeschke