Deadlocks with pthreads and CreateThread?

I would try double checking your mutexes in thread 2 and thread 3. Pthreads are implemented for windows using the standard windows api; So there will be slight differences between the windows and linux versions. This is a bizarre problem, but then again, that happens a lot in threading.

I would try double checking your mutexes in thread 2 and thread 3. Pthreads are implemented for windows using the standard windows api; So there will be slight differences between the windows and linux versions. This is a bizarre problem, but then again, that happens a lot in threading.

Could you try posting a snippet of the code where the locking is done in thread 2, and in the function that thread 3 should start in? Edit in response to code Did you ever unlock the mutex in thread 2? Your trace shows it locking a mutex, then creating a thread to do all that work which tries to also lock on the mutex.

I'm guessing after thread 2 returns SUCESS it does? Also, why are you using flags and sleeping, perhaps barriers or conditional variables for process synchronization may be more robust. Another note, is b_thread_active flag marked as volatile?

Perhaps the compiler is caching something to not allow it to break out?

Added a bunch of specific code. – Dark Shikari Feb 19 '09 at 22:01 Good catch on the volatile--I'll go test that and see if it is the problem. According to another dev gcc has a habit of inconsistent behavior with regard to non-volatile variables in threaded mode across platforms, which could result in Linux working fine but Windows breaking.

– Dark Shikari Feb 19 '09 at 22:13 And you were right; while there were other bugs in the code, the missing volatile was what caused this particular bug. – Dark Shikari Feb 20 '09 at 4:20.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions