This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with pthread mutexes

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 && \
#include <pthread.h>
#include <stdlib.h>

int main() {
   int result;
   pthread_mutexattr_t mutex_attr;

   if ((result = pthread_mutexattr_init(&mutex_attr)) != 0)


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]