Hi, In the test program below, pthread_key_create is failing with return value EBUSY with no good reason. The explanation in http://www.mail-archive.com/cygwin%40cygwin.com/msg49835.html does not apply since I'm not calling pthread_key_create on an existing key's address, but a destroyed key's address.
$ gcc test-tls.c -o test-tls.exe $ ./test-tls.exe trying to get key #0 trying to get key #1 trying to get key #2 trying to get key #3 destroying key #0 destroying key #1 destroying key #2 destroying key #3 trying to get key #3 trying to get key #2 trying to get key #1 pthread_key_create -> 16 Aborting at line 31 Aborted (core dumped) The Cygwin version that I'm using is: $ grep VERSION /usr/include/cygwin/version.h | head -2 #define CYGWIN_VERSION_DLL_MAJOR 1005 #define CYGWIN_VERSION_DLL_MINOR 19 ============================= test-tls.c ================================ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #define abort() (fprintf(stderr, "Aborting at line %d\n", __LINE__), abort()) #define KEYS_COUNT 4 static pthread_key_t mykeys[KEYS_COUNT]; int main () { int i; for (i = 0; i < KEYS_COUNT; i++) { fprintf (stderr, "trying to get key #%d\n", i); fflush (stderr); int err = pthread_key_create (&mykeys[i], free); if (err != 0) { fprintf (stderr, "pthread_key_create -> %d\n", err); abort (); } } for (i = 0; i < KEYS_COUNT; i++) { fprintf (stderr, "destroying key #%d\n", i); if (pthread_key_delete (mykeys[i]) != 0) abort (); } for (i = KEYS_COUNT - 1; i >= 0; i--) { fprintf (stderr, "trying to get key #%d\n", i); fflush (stderr); int err = pthread_key_create (&mykeys[i], free); if (err != 0) { fprintf (stderr, "pthread_key_create -> %d\n", err); abort (); } } for (i = 0; i < KEYS_COUNT; i++) { fprintf (stderr, "destroying key #%d\n", i); if (pthread_key_delete (mykeys[i]) != 0) abort (); } return 0; } -- 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/