Author: rfm
Date: Tue Jun 30 10:43:28 2015
New Revision: 38722
URL: http://svn.gna.org/viewcvs/gnustep?rev=38722&view=rev
Log:
Diagnostic for deadlocked threads
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Headers/GNUstepBase/config.h.in
libs/base/trunk/Source/NSLock.m
Modified: libs/base/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=38722&r1=38721&r2=38722&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Tue Jun 30 10:43:28 2015
@@ -5,6 +5,8 @@
* Headers/GNUstepBase/config.h.in:
Add test for pthread_mutex_t.__data.__owner
Update various tests to silence autoconf warnings.
+ * Source/NSLock.m: If available, use pthread_mutex_t.__data.__owner
+ to print the owning thread ID when a lock is deadlocked.
2015-06-26 Riccardo Mottola <[email protected]>
@@ -26,7 +28,8 @@
* Headers/Foundation/NSData.h
* Source/NSData.m
- base64EncodedDataWithOptions, base64EncodedStringWithOptions: first
implementation
+ base64EncodedDataWithOptions, base64EncodedStringWithOptions:
+ first implementation
2015-06-08 Richard Frith-Macdonald <[email protected]>
Modified: libs/base/trunk/Headers/GNUstepBase/config.h.in
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Headers/GNUstepBase/config.h.in?rev=38722&r1=38721&r2=38722&view=diff
==============================================================================
--- libs/base/trunk/Headers/GNUstepBase/config.h.in (original)
+++ libs/base/trunk/Headers/GNUstepBase/config.h.in Tue Jun 30 10:43:28 2015
@@ -789,6 +789,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
@@ -884,6 +887,11 @@
# endif
#endif
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
Modified: libs/base/trunk/Source/NSLock.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSLock.m?rev=38722&r1=38721&r2=38722&view=diff
==============================================================================
--- libs/base/trunk/Source/NSLock.m (original)
+++ libs/base/trunk/Source/NSLock.m Tue Jun 30 10:43:28 2015
@@ -91,7 +91,7 @@
}\
if (EDEADLK == err)\
{\
- _NSLockError(self, _cmd, YES);\
+ _NSLockError(self, _cmd, YES, &_mutex);\
}\
}
#define MLOCKBEFOREDATE \
@@ -132,10 +132,15 @@
/*
* OS X 10.5 compatibility function to allow debugging deadlock conditions.
*/
-void _NSLockError(id obj, SEL _cmd, BOOL stop)
-{
+void _NSLockError(id obj, SEL _cmd, BOOL stop, pthread_mutex_t *mutex)
+{
+#if defined(HAVE_PTHREAD_MUTEX_OWNER)
+ NSLog(@"*** -[%@ %@]: deadlock (%@), held by thread %d", [obj class],
+ NSStringFromSelector(_cmd), obj, mutex->__data.__owner);
+#else
NSLog(@"*** -[%@ %@]: deadlock (%@)", [obj class],
NSStringFromSelector(_cmd), obj);
+#endif
NSLog(@"*** Break on _NSLockError() to debug.");
if (YES == stop)
pthread_mutex_lock(&deadlock);
@@ -215,7 +220,7 @@
}
if (EDEADLK == err)
{
- _NSLockError(self, _cmd, NO);
+ _NSLockError(self, _cmd, NO, &_mutex);
}
sched_yield();
} while ([limit timeIntervalSinceNow] > 0);
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs