mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Post the NSThreadWillExit notification when unregistering alien threads
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9450 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2d97ccb6b4
commit
3db7c2593a
3 changed files with 25 additions and 3 deletions
|
@ -475,15 +475,35 @@ void
|
|||
GSUnregisterCurrentThread (void)
|
||||
{
|
||||
NSThread *thread;
|
||||
static NSNotificationCenter *nc = nil;
|
||||
static Class notificationClass = Nil;
|
||||
|
||||
if (nc == nil)
|
||||
{
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
notificationClass = [NSNotification class];
|
||||
}
|
||||
|
||||
thread = GSCurrentThread();
|
||||
|
||||
if (thread->_active == YES)
|
||||
{
|
||||
NSNotification *n;
|
||||
|
||||
/*
|
||||
* Set the thread to be inactive to avoid any possibility of recursion.
|
||||
*/
|
||||
thread->_active = NO;
|
||||
|
||||
/*
|
||||
* Let observers know this thread is exiting.
|
||||
*/
|
||||
n = [notificationClass alloc];
|
||||
n = [n initWithName: NSThreadWillExitNotification
|
||||
object: thread
|
||||
userInfo: nil];
|
||||
[nc postNotification: n];
|
||||
RELEASE(n);
|
||||
|
||||
/*
|
||||
* destroy the thread object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue