This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
Trouble with mutexes (mutexii?)
- To: pthreads-win32 at sourceware dot cygnus dot com
- Subject: Trouble with mutexes (mutexii?)
- From: "Stephen R. Johns" <stephen dot johns at securelogix dot com>
- Date: Tue, 13 Mar 2001 16:41:22 -0600
Background
I am porting an existing program that makes use of pthreads to NT.
Currently testing under Win2000 5.00.2195 and NT 4.00.1381.
I am using what I believe is the latest version of the pthreads stuff,
pthreads-2000-12-29.exe. I am building stuff with a mingw32 gcc
cross compiler that I pulled from the mingw32 site.
The program I am porting currently runs correctly under linux
2.2.14-5.0 and a custom build of linux that we have.
Things have gone fairly smoothly, but I am getting the following
behavior and have run out of ideas.
There is one thread that initializes stuff and it does:
pthread_mutex_lock
<stuff>
pthread_mutex_unlock
Two other threads make calls to pthread_mutex_lock awaiting the
completion of the initialization.
Tracing through the code, all 3 pthread_mutex_lock calls are made,
and the pthread_mutex_unlock call is made after the initialization
stuff is done. The problem I am seeing is that neither of the other
2 waiting threads ever gets past the pthread_mutex_lock call. They
continue to wait forever. No error or warning diagnostics are
generated.
I have verified that all threads are successfully created and are
running.
While debugging this, I have noticed that the
pthread_mutex_t->lockCount never changes, it is always 0. In an
attempt to force a hint out of the system, I have tried manually
setting the lockCount, but my assignements have no effect,
pmt->lockCount is always 0. This seems bad.
Any ideas or information is greatly appreciated.