www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/25/22:09:05

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Message-ID: <41562527.739ED3B9@dessent.net>
Date: Sat, 25 Sep 2004 19:10:47 -0700
From: Brian Dessent <brian AT dessent DOT net>
Organization: My own little world...
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Problems with pthread mutexes
References: <BAY9-F23DqaJY4kJSFs000052dd AT hotmail DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com

Arash Partow wrote:

> I've got a problem with pthread mutexes and cygwin. When I try to initialise
> a mutex
> attribute variable, the related pthread call never returns a 0 (zero) value.
> 
> ie:
> 
>    int result = 0;
>    pthread_mutexattr_t mutex_attr;
> 
>    if ((result = pthread_mutexattr_init(&mutex_attr)) != 0)
>    {
>       printf("Error - Description: %s\n",stderror(result));
>       exit(EXIT_FAILURE);
>    }
> 
> I'm using the latest snapshot as of 24th Sept, and also got the latest
> gcc, I'm running on windows 2000 with sp4, I've also tried on win xp
> with sp2 same cygwin install etc, yet the same problem occurs.
> 
> Same code compiles ok on NetBSD 1.62 and Mandrake 10.1 and gives
> a non erroneous return code.

It must be something your code is doing wrong -- something not in the
above snippet.  I think you'll find that if you can narrow it down to a
simple testcase that compiles and exhibits the error it will be much
easier to find out what's wrong.  Your above code works fine for me:

$ cat >pthread_mutexattr.c <<EOF && \
gcc -o pthread_mutexattr.exe pthread_mutexattr.c && \
./pthread_mutexattr
#include <pthread.h>
#include <stdlib.h>

int main() {
   int result;
   pthread_mutexattr_t mutex_attr;

   if ((result = pthread_mutexattr_init(&mutex_attr)) != 0)
      perror("pthread_mutexattr_init");
   else
      printf("success");
}
EOF
success

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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