mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +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
9c9f7b0154
commit
e2b67d2873
2 changed files with 18 additions and 5 deletions
|
@ -5,6 +5,7 @@
|
||||||
with software expecting to validate using that dtd.
|
with software expecting to validate using that dtd.
|
||||||
Stefan Bidigaray pointed out that the heading we currently write is
|
Stefan Bidigaray pointed out that the heading we currently write is
|
||||||
very out of date.
|
very out of date.
|
||||||
|
* Source/NSThread.m: On premature thread exist, log native thread ID.
|
||||||
|
|
||||||
2015-07-09 Richard Frith-Macdonald <rfm@gnu.org>
|
2015-07-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ GSPrivateThreadID()
|
||||||
#elif defined(HAVE_GETTID)
|
#elif defined(HAVE_GETTID)
|
||||||
return (NSUInteger)syscall(SYS_gettid);
|
return (NSUInteger)syscall(SYS_gettid);
|
||||||
#elif defined(HAVE_PTHREAD_GETTHREADID_NP)
|
#elif defined(HAVE_PTHREAD_GETTHREADID_NP)
|
||||||
return pthread_getthreadid_np();
|
return (NSUInteger)pthread_getthreadid_np();
|
||||||
#else
|
#else
|
||||||
return (NSUInteger)GSCurrentThread();
|
return (NSUInteger)GSCurrentThread();
|
||||||
#endif
|
#endif
|
||||||
|
@ -412,8 +412,20 @@ static void exitedThread(void *thread)
|
||||||
{
|
{
|
||||||
if (thread != defaultThread)
|
if (thread != defaultThread)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "WARNING thread %p terminated without calling +exit!\n",
|
NSUInteger tid;
|
||||||
thread);
|
|
||||||
|
#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
|
- (NSString*) description
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat: @"%@{name = %@, num = %llu}",
|
return [NSString stringWithFormat: @"%@{name = %@, num = %"PRIuPTR"}",
|
||||||
[super description], _name, (unsigned long long)GSPrivateThreadID()];
|
[super description], _name, GSPrivateThreadID()];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue