Author: rfm
Date: Tue Jul 14 20:05:55 2015
New Revision: 38791
URL: http://svn.gna.org/viewcvs/gnustep?rev=38791&view=rev
Log:
improve logging of threwad id on premature exit
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Source/NSThread.m
Modified: libs/base/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=38791&r1=38790&r2=38791&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Tue Jul 14 20:05:55 2015
@@ -5,6 +5,7 @@
with software expecting to validate using that dtd.
Stefan Bidigaray pointed out that the heading we currently write is
very out of date.
+ * Source/NSThread.m: On premature thread exist, log native thread ID.
2015-07-09 Richard Frith-Macdonald <[email protected]>
Modified: libs/base/trunk/Source/NSThread.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSThread.m?rev=38791&r1=38790&r2=38791&view=diff
==============================================================================
--- libs/base/trunk/Source/NSThread.m (original)
+++ libs/base/trunk/Source/NSThread.m Tue Jul 14 20:05:55 2015
@@ -119,7 +119,7 @@
#elif defined(HAVE_GETTID)
return (NSUInteger)syscall(SYS_gettid);
#elif defined(HAVE_PTHREAD_GETTHREADID_NP)
- return pthread_getthreadid_np();
+ return (NSUInteger)pthread_getthreadid_np();
#else
return (NSUInteger)GSCurrentThread();
#endif
@@ -412,8 +412,20 @@
{
if (thread != defaultThread)
{
- fprintf(stderr, "WARNING thread %p terminated without calling +exit!\n",
- thread);
+ NSUInteger tid;
+
+#if defined(__MINGW__)
+ tid = (NSUInteger)GetCurrentThreadId();
+#elif defined(HAVE_GETTID)
+ tid = (NSUInteger)syscall(SYS_gettid);
+#elif defined(HAVE_PTHREAD_GETTHREADID_NP)
+ tid = (NSUInteger)pthread_getthreadid_np();
+#else
+ tid = (NSUInteger)thread;
+#endif
+
+ fprintf(stderr, "WARNING thread %"PRIuPTR
+ " terminated without calling +exit!\n", tid);
}
}
@@ -796,8 +808,8 @@
- (NSString*) description
{
- return [NSString stringWithFormat: @"%@{name = %@, num = %llu}",
- [super description], _name, (unsigned long long)GSPrivateThreadID()];
+ return [NSString stringWithFormat: @"%@{name = %@, num = %"PRIuPTR"}",
+ [super description], _name, GSPrivateThreadID()];
}
- (id) init
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs