This happens to me, too, with a simple test program on Cygwin 1.3.5-3 + Windows 2K + gcc 2.95.3.
This is a bug in file winsup/thread.cc function __pthread_mutex_init. The idea is that static mutex's are initialized with a magic value (0x14). The first time the mutex is locked or unlocked, __pthread_mutex_init is supposed to initialize it. But __pthread_mutex_init does not handle the case of VALID_STATIC_OBJECT correctly, so the mutex never gets initialized. This bit me last week and I got that far in analyzing it when the CVS version of thread.cc got fixed. Also several dozen test programs were added for threads. So I am a happy camper with CVS winsup. Here is my test program. It prints "16" and "22" on Cygwin 1.3.5-3, and it prints "0" and "0" with CVS winsup. Michael Elizabeth Chastain <[EMAIL PROTECTED]> "love without fear" === #include <pthread.h> #include <stdio.h> pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER; int main () { int rv; rv = pthread_mutex_lock (&m1); printf ("pthread_mutex_lock: %d\n", rv); rv = pthread_mutex_unlock (&m1); printf ("pthread_mutex_unlock: %d\n", rv); return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/