This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos 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: pthread_exit() and tss destructors


Robin Farine <robin.farine@acn-group.ch> writes:

> Hi,
> 
> Third-party code using POSIX threads and tss caused me some trouble when
> such a thread exited. It turned out that tss destructors got called
> multiple times for the same key. According to the POSIX 1003.1 standard,
> the code calling these destructors should set each value to NULL before
> calling the associated destructor.
> 

It is my reading of the standard that it is the responsibility of the
destructor function itself to set the value to NULL, or some other
value. Otherwise there would be no need for {PTHREAD_DESTRUCTOR_ITERATIONS}.

There is nothing in the rationale about this either. This looks like
one of those situations where the POSIX standard is incompletely
specific. To be completely portable it looks like destructor code
cannot assume that the keys will be NULLed, and must do it itself with
pthread_setspecific().



-- 
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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