2002-09-27 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_key::run_destructor): Run_destructor is not const as it needs to set the key value. * thread.h (pthread_key::run_destructor): Ditto. 2002-09-27 Robert Collins <rbtcollins@hotmail.com> * thread.cc (pthread_key::run_destructor): Follow opengroup algorithm. I.e. only run the destructor NON-NULL key values, and reset the key to NULL before running the destructor. Reported by Thomas Pfaff.
This commit is contained in:
@ -1035,10 +1035,17 @@ pthread_key::recreateKeyFromBuffer ()
|
||||
}
|
||||
|
||||
void
|
||||
pthread_key::run_destructor () const
|
||||
pthread_key::run_destructor ()
|
||||
{
|
||||
if (destructor)
|
||||
destructor (get ());
|
||||
if (destructor)
|
||||
{
|
||||
void *oldValue = get();
|
||||
if (oldValue)
|
||||
{
|
||||
set (NULL);
|
||||
destructor (oldValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*pshared mutexs:
|
||||
|
Reference in New Issue
Block a user