Author: rfm
Date: Mon Jun 27 22:21:11 2016
New Revision: 39935
URL: http://svn.gna.org/viewcvs/gnustep?rev=39935&view=rev
Log:
windows fixup for pthread exit with null pointer
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=39935&r1=39934&r2=39935&view=diff
==============================================================================
--- libs/base/trunk/Source/NSThread.m (original)
+++ libs/base/trunk/Source/NSThread.m Mon Jun 27 22:21:11 2016
@@ -569,6 +569,17 @@
{
NSValue *ref;
+ if (0 == thread)
+ {
+ /* On some systems this is called with a null thread pointer,
+ * so try to ger the NSThread object for the current thread.
+ */
+ thread = pthread_getspecific(thread_object_key);
+ if (0 == thread)
+ {
+ return; // no thread info
+ }
+ }
RETAIN((NSThread*)thread);
ref = NSValueCreateFromPthread(pthread_self());
_willLateUnregisterThread(ref, (NSThread*)thread);
@@ -810,7 +821,7 @@
t = GSCurrentThread();
if (t->_active == YES)
{
- unregisterActiveThread (t);
+ unregisterActiveThread(t);
if (t == defaultThread || defaultThread == nil)
{
@@ -1742,7 +1753,7 @@
* </p>
*/
BOOL
-GSRegisterCurrentThread (void)
+GSRegisterCurrentThread(void)
{
return [NSThread _createThreadForCurrentPthread];
}
@@ -1762,7 +1773,7 @@
* </p>
*/
void
-GSUnregisterCurrentThread (void)
+GSUnregisterCurrentThread(void)
{
unregisterActiveThread(GSCurrentThread());
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs