On Sun, 7 Jan 2007, Daniel Molina Wegener wrote:
Hello,I'm coding with pthreads, but the behavior of pthread_key_delete is strange. When I use pthread_key_delete, and I do not wait for the automatic deallocation of thread specific data, I receive a strange warning: Thread 8053800 has exited with leftover thread-specific data after \ 4 destructor iterations ¿Is this a mistake in the code or a standard warning in FreeBSD pthreads?
Yes, it looks like a buggy program...
The code bellow can be compiled with and do not use the pthread_key_delete routine:
See the POSIX spec with regard to pthread_key_create(): http://www.opengroup.org/onlinepubs/009695399/functions/pthread_key_create.html You may have to create an account (free) in order to view it. Also look at pthread_key_delete(). I think the problem is that you are calling pthread_key_delete() from the thread that is creating the key and before the thread has exited (when the thread-specific key data is destroyed). You have invalidated the key by deleting it, so when the thread exits, it can't call the destructor and it iterates PTHREAD_KEY_MAX times trying to deallocate the key data. That is where the error message is generated. -- DE
_______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"