This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
pthread_mutex_trylock does not lock
- From: "Chris Knight" <c dot knight at teligent dot co dot uk>
- To: <cygwin at cygwin dot com>
- Date: Tue, 3 Dec 2002 09:37:41 -0000
- Subject: pthread_mutex_trylock does not lock
Hello,
I think I have found a problem in the "pthread_mutex_trylock" call. When I
run the following code both the trylock and lock return immediately. If I
compile this under RedHat 8 it works as I would expect with the trylock
locking the mutex and the lock stopping execution.
I am running the latest version of cygwin under Windows 2000 Pro with the
latest service packs.
/* -------------------------------------------------------------------------
-------- */
#include <pthread.h>
int main (void)
{
pthread_mutex_t accessMutex = PTHREAD_MUTEX_INITIALIZER;
printf ("Init\n");
pthread_mutex_init(&accessMutex, NULL);
printf ("Try lock(%d)\n", pthread_mutex_trylock(&accessMutex));
printf ("Lock(%d)\n", pthread_mutex_lock(&accessMutex));
printf ("We should never get here!");
}
/* -------------------------------------------------------------------------
-------- */
Chris Knight
Development, Teligent Ltd.
Office: +44 (1442) 283818
Mobile: +44 (7971) 646218
Email: c.knight@teligent.co.uk
--
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/