Author: rfm
Date: Sat Mar  5 20:09:11 2016
New Revision: 39467

URL: http://svn.gna.org/viewcvs/gnustep?rev=39467&view=rev
Log:
fixup for late unregister on windows

Modified:
    libs/base/trunk/Source/NSThread.m

Modified: libs/base/trunk/Source/NSThread.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSThread.m?rev=39467&r1=39466&r2=39467&view=diff
==============================================================================
--- libs/base/trunk/Source/NSThread.m   (original)
+++ libs/base/trunk/Source/NSThread.m   Sat Mar  5 20:09:11 2016
@@ -516,26 +516,20 @@
   NSThread *specific)
 {
   [_exitingThreadsLock lock];
-  NS_DURING
-    {
-      /* The map table is created lazily/late so that the NSThread
-       * +initilize method can be called without causing other
-       * classes to be initialized.
-       */
-      if (nil == _exitingThreads)
-        {
-          _exitingThreads = NSCreateMapTable(_boxedPthreadKeyCallBacks,
-            NSObjectMapValueCallBacks, 10);
-        }
-      NSMapInsert(_exitingThreads, (const void*)boxedThread,
-        (const void*)specific);
-    }
-  NS_HANDLER
-    {
-      [_exitingThreadsLock unlock];
-      [localException raise];
-    }
-  NS_ENDHANDLER
+  /* The map table is created lazily/late so that the NSThread
+   * +initilize method can be called without causing other
+   * classes to be initialized.
+   * NB this locked section cannot be protected by an exception handler
+   * because the exception handler stores information in the current
+   * thread variables ... which causes recursion.
+   */
+  if (nil == _exitingThreads)
+    {
+      _exitingThreads = NSCreateMapTable(_boxedPthreadKeyCallBacks,
+       NSObjectMapValueCallBacks, 10);
+    }
+  NSMapInsert(_exitingThreads, (const void*)boxedThread,
+    (const void*)specific);
   [_exitingThreadsLock unlock];
 }
 
@@ -546,19 +540,14 @@
  */
 static inline void _didLateUnregisterCurrentThread(NSValue *boxedThread)
 {
+  /* NB this locked section cannot be protected by an exception handler
+   * because the exception handler stores information in the current
+   * thread variables ... which causes recursion.
+   */
   [_exitingThreadsLock lock];
   if (nil != _exitingThreads)
     {
-      NS_DURING
-        {
-          NSMapRemove(_exitingThreads, (const void*)boxedThread);
-        }
-      NS_HANDLER
-        {
-          [_exitingThreadsLock unlock];
-          [localException raise];
-        }
-      NS_ENDHANDLER
+      NSMapRemove(_exitingThreads, (const void*)boxedThread);
     }
   [_exitingThreadsLock unlock];
 }


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to