delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/03/04:37:58

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Chris Knight" <c DOT knight AT teligent DOT co DOT uk>
To: <cygwin AT cygwin DOT com>
Subject: pthread_mutex_trylock does not lock
Date: Tue, 3 Dec 2002 09:37:41 -0000
Message-ID: <IGEKLLNAJDPOMLJGIFBIAECHCCAA.c.knight@teligent.co.uk>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Importance: Normal

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 DOT knight AT teligent DOT co DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019