diff options
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: |