This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Linux pthread_mutexattr_init?
- From: "Loic Domaigne" <loic-dev at gmx dot net>
- To: dmarkh at cfl dot rr dot com
- Cc: libc-alpha at sources dot redhat dot com
- Date: Tue, 1 Feb 2005 07:14:33 +0100 (MET)
- Subject: Re: Linux pthread_mutexattr_init?
- References: <41FB7B42.2040403@cfl.rr.com>
Hi!
> I'm using glibc-2.3.3 on i386 platform running kernel 2.6.11. The man
> page for pthread_mutexattr_init indicates I can use the
> PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP type of Mutex however the only
> type I can successfully build my program with is
> PTHREAD_MUTEX_INITIALIZER.
>
> #include <pthread.h>
> pthread_mutex_t Q_lock = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
>
> Causes the following error when I compile my pgm with gcc.
>
> global.c:471: error: `PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP'
> undeclared here (not in a function)
>
>
> Is the man page incorrect? Does Linux/glibc support the
> PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP? If so is there a trick to using
> other than the default PTHREAD_MUTEX_INITIALIZER type of mutex?
It is not an error in the man page. You must enable the GNU extension with
the flag -D_GNU_SOURCE to gcc in order to access such non portable (hence
the ending in "_NP") features.
HTH,
Loic.
--
--
// Sender address goes to /dev/null (!!)
// Use my 32/64 bits, ANSI C89, compliant email-address instead:
unsigned y[]=
{0,34432,26811,16721,41866,63119,61007,48155,26147,10986};
void x(z){putchar(z);}; unsigned t;
main(i){if(i<10){t=(y[i]*47560)%65521;x(t>>8);x(t&255);main(++i);}}
GMX im TV ... Die Gedanken sind frei ... Schon gesehen?
Jetzt Spot online ansehen: http://www.gmx.net/de/go/tv-spot