ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] Re: Thread lib (good reason for static)
by Alexander Terekhov other posts by this author
Jun 8 2004 8:26AM messages near this date
Re: [boost] Re: boost::any question | [boost] boost::any question
SOURCE 
Johan Nilsson wrote:
[...]
>  Do you mean that the "destructors" can allocate/use tss under execution, or?

<quote> 

After all cancellation cleanup handlers have been executed, if 
the thread has any thread-specific data, appropriate destructor 
functions shall be called in an unspecified order. [...] Both 
pthread_getspecific() and pthread_setspecific() may be called 
from a thread-specific data destructor function. A call to 
pthread_getspecific() for the thread-specific data key being 
destroyed shall return the value NULL, unless the value is 
changed (after the destructor starts) by a call to 
pthread_setspecific(). Calling pthread_setspecific() from a 
thread-specific data destructor routine may result either in 
lost storage (after at least PTHREAD_DESTRUCTOR_ITERATIONS 
attempts at destruction) or in an infinite loop.

</quote> 

>  What is the definition of "destructors" under pthreads, anyway (I assume
>  it's not the same as a C++ destructor)?

It's extern "C" void (*destructor)(void*));

<quote> 

An optional destructor function may be associated with each 
key value. 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. The order 
of destructor calls is unspecified if more than one 
destructor exists for a thread when it exits. If, after all 
the destructors have been called for all non-NULL values 
with associated destructors, there are still some non-NULL 
values with associated destructors, then the process is 
repeated. If, after at least {PTHREAD_DESTRUCTOR_ITERATIONS} 
iterations of destructor calls for outstanding non-NULL 
values, there are still some non-NULL values with associated 
destructors, implementations may stop calling destructors, 
or they may continue calling destructors until no non-NULL 
values with associated destructors exist, even though this 
might result in an infinite loop.

</quote> 

regards,
alexander.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved