This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: TSD destructors not being called for initial thread

I'm just poking my nose in, but...

On Wed, Mar 31, 2004 at 10:34:32AM -0800, Kaz Kylheku wrote:
> On Wed, 31 Mar 2004, Boris Kolpackov wrote:
> > What you said makes sense, but the spec (SUS) says
> > 
> >   "At thread exit, if a key value has a non-NULL destructor pointer, 
> >    and the thread has a non-NULL value associated with that key, the 
> >    value of the key is set to NULL, and then the function pointed to 
> >    is called with the previously associated value as its sole argument."
> > 
> > Also it never says that this does not apply to the initial thread.
> That is true. However, there are no guarantees about how soon the
> cleanup happens. If the cleanup is delayed until the process
> terminates, then it's okay for it not to happen.
> The spec doesn't say that the first destructor must be called within X
> milliseconds of the pthread_exit(). 
> What you do know is that the destructors are called in the context of
> the thread that is shutting down, so that by the time a pthread_join()
> succeeds on that thread, the destructors must be done.  
> If you can join the thread, and the destructors have not been called,
> then you have a problem, because certain events did not happen
> in their implied causal order.

Is that really a permissible interpretation?  The SUS quote says "At
thread exit ... the function pointed to _is called_".  "Optimizing" by
not calling the function at all seems pretty specious.

Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]