strange pthread keys behavior
Daniel Molina Wegener
dmw at unete.cl
Sun Jan 7 19:36:51 UTC 2007
On Sunday 07 January 2007 12:44, Daniel Eischen wrote:
> > ¿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():
> 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
. 0 . | Daniel Molina Wegener
. . 0 | dmw at unete dot cl
0 0 0 | FreeBSD User
More information about the freebsd-hackers