mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 17:41:05 +00:00
Merge from 0.6.5
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6040 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5276d1b6c2
commit
fb65f2b8b6
36 changed files with 1074 additions and 479 deletions
|
@ -67,31 +67,47 @@ static NSMapTable *activeTasks = 0;
|
|||
|
||||
@implementation NSTask
|
||||
|
||||
static BOOL hadChildSignal = NO;
|
||||
static void handleSignal(int sig)
|
||||
{
|
||||
int result;
|
||||
int status;
|
||||
hadChildSignal = YES;
|
||||
}
|
||||
|
||||
do
|
||||
BOOL
|
||||
GSCheckTasks()
|
||||
{
|
||||
BOOL found = NO;
|
||||
|
||||
if (hadChildSignal)
|
||||
{
|
||||
result = waitpid(-1, &status, WNOHANG);
|
||||
if (result > 0)
|
||||
{
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
NSTask *t;
|
||||
int result;
|
||||
int status;
|
||||
|
||||
[tasksLock lock];
|
||||
t = (NSTask*)NSMapGet(activeTasks, (void*)result);
|
||||
[tasksLock unlock];
|
||||
if (t)
|
||||
{
|
||||
[t _terminatedChild: WEXITSTATUS(status)];
|
||||
}
|
||||
}
|
||||
}
|
||||
hadChildSignal = NO;
|
||||
|
||||
do
|
||||
{
|
||||
result = waitpid(-1, &status, WNOHANG);
|
||||
if (result > 0)
|
||||
{
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
NSTask *t;
|
||||
|
||||
[tasksLock lock];
|
||||
t = (NSTask*)NSMapGet(activeTasks, (void*)result);
|
||||
[tasksLock unlock];
|
||||
if (t)
|
||||
{
|
||||
[t _terminatedChild: WEXITSTATUS(status)];
|
||||
found = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (result > 0);
|
||||
}
|
||||
while (result > 0);
|
||||
return found;
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue