pthread_attr_init() returning errors

Corinna Vinschen
Wed Apr 20 10:54:00 GMT 2016

On Apr 19 19:49, Canham, Timothy K (348C) wrote:
> I have some code to start a task that suddenly started failing. This is pretty mature code. Here is the code fragment with my added printf()
>         pthread_attr_t att;
>         int stat = pthread_attr_init(&att);
>         if (stat != 0) {
>             printf("pthread_attr_init: (%d)(%d): %s\n",stat,errno,strerror(stat));
>             // return
>         }
> Here is the output:
> pthread_attr_init: (16)(0): Device or resource busy

This is most unusual.  What happens is this:

A pthread_attr_t is a pointer to a pointer to a struct with a magic
number.  And at the start of pthread_attr_init this magic number is
tested if it's already the magic number expected for an object of type
pthread_attr_t.  And only if so, the pthread_attr_init function fails
with EBUSY.

That means, the arbitrary value in the uninitialized att prior to 
the call to pthread_attr_init is a pointer value which points to
valid memory which has the magic value 0xdf0df048.  Wow.

This means we can't keep up with the tests in the pthread_FOO_init
functions since they could point to an *supposedly* initialized 
object, while in fact the value they point to is only accidentally
so that it looks like an initialized object.

I provided new developer snapshots on
and I've just uploaded a 2.5.1-0.1 test release which you can install
via setup as soon as your mirror has catched up.

Pleaser give any of them a try.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <>

More information about the Cygwin mailing list