Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sun, 7 Jul 2002 00:40:42 +0200 (CEST) From: Clemens Fuchslocher To: Subject: 1.3.12: pthread mutex - second lock won't block. Message-ID: <57370207062339390-100000@foo> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII hi, If I lock a fast mutex twice, it normaly should block forever. But I can't reproduce that behavior under the current cygwin version. The mutex won't block after the second lock. The behavior under cygwin is similar to a recursive mutex. What's wrong? Test.c: -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= /* gcc -Wall -lpthread test.c -o test */ #include #include #include #include #include #define __USE_GNU #include pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; int main (void) { int ret; if ((ret = pthread_mutex_lock (&lock)) != 0) { printf ("pthread_mutex_lock (): %s\n", strerror (ret)); return EXIT_FAILURE; } if ((ret = pthread_mutex_lock (&lock)) != 0) { printf ("pthread_mutex_lock (): %s\n", strerror (ret)); return EXIT_FAILURE; } printf ("DEADBEEF!\n"); return EXIT_SUCCESS; } -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= Under Linux and SunOS the second lock will cause a deadlock. -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= zero:~$ uname -a Linux foo 2.4.18 #1 Thu Jul 4 22:49:55 CEST 2002 i686 unknown zero:~$ /lib/libc.so.6 | head -1 GNU C Library stable release version 2.2.5, by Roland McGrath et al. zero:~$ gcc -Wall -lpthread test.c -o test zero:~$ ./test zero:~> uname -sr SunOS 5.6 zero:~> gcc -Wall -lpthread test.c -o test zero:~> ./test -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= Under cygwin the second lock will not block. -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= ~$ uname -a CYGWIN_98-4.10 GADGET 1.3.12(0.54/3/2) 2002-07-03 16:42 i686 unknown ~$ gcc -Wall -lpthread test.c -o test ~$ ./test.exe DEADBEEF! ~$ -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -- :) -- 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/