Re: Patch libpthread_globsigdisp
Thomas DiModica, le Wed 15 Aug 2012 16:58:20 -0700, a écrit :
> why it is not called in __pthread_sigstate_destroy
I don't know, Jérémie added that.
> That would seem to be the proper place for it.
It looks like it.
> My concern is this: __pthread_thread_halt is generally called twice for a
> given thread: once by the thread itself in pthread_exit, the second time by
> another thread in either pthread_join, pthread_detach, or __pthread_alloc.
> I don't, however, know the result for calling _hurd_sigstate_delete twice on
> a thread: it cannot be bad or the patch would never have been submitted.
See the code for it: it removes the structure corresponding to the
thread from the list, but only if it finds it, so calling a second time
simply does nothing.
> I just feel that the call should be made once for the thread, which is what
> the code has the structure for: in __pthread_sigstate_destroy, which a
> thread calls on itself in pthread_exit.
Yes, except that I see a danger: what if a signal is sent to the
thread around the time it is calling pthread_exit()? I don't
remember the details, but I guess if that happens after the call to
_hurd_sigstate_delete(), the sigstate will be reallocated and thus
leaked (or some other bad such thing).
> I'm sorry if I am nit-picking. The patch came up as a problem source
> in the move of the hurd to pthreads (the patch itself isn't the problem,
> but its consequences introduce a problem).