diff options
author | Robert Collins <rbtcollins@hotmail.com> | 2002-09-27 15:08:50 +0000 |
---|---|---|
committer | Robert Collins <rbtcollins@hotmail.com> | 2002-09-27 15:08:50 +0000 |
commit | da6a08decb95746b85f4562c2d3ac921eed9d91b (patch) | |
tree | 744515c9050c47ab9335635f2ec856dd2014f405 /winsup/cygwin/thread.cc | |
parent | 39bd4d5016ebad6803e2865b5494ffd5a495b4f1 (diff) | |
download | cygnal-da6a08decb95746b85f4562c2d3ac921eed9d91b.tar.gz cygnal-da6a08decb95746b85f4562c2d3ac921eed9d91b.tar.bz2 cygnal-da6a08decb95746b85f4562c2d3ac921eed9d91b.zip |
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.
Diffstat (limited to 'winsup/cygwin/thread.cc')
-rw-r--r-- | winsup/cygwin/thread.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 3ee11f1e9..6b05cffb2 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -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: |