mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
improve logging of threwad id on premature exit
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38791 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
796c806c8e
commit
b571ae5fb9
2 changed files with 18 additions and 5 deletions
|
@ -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 <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ GSPrivateThreadID()
|
|||
#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 @@ static void exitedThread(void *thread)
|
|||
{
|
||||
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 @@ unregisterActiveThread(NSThread *thread)
|
|||
|
||||
- (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
|
||||
|
|
Loading…
Reference in a new issue