better approach to subprocess polling
svn: r9242
This commit is contained in:
parent
ff98bea44a
commit
8f1a970398
|
@ -6483,10 +6483,10 @@ static void init_sigchld(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int scheme_check_child_done()
|
static void check_child_done()
|
||||||
{
|
{
|
||||||
pid_t result;
|
pid_t result;
|
||||||
int status, did_one = 0;
|
int status;
|
||||||
System_Child *sc, *prev;
|
System_Child *sc, *prev;
|
||||||
|
|
||||||
if (scheme_system_children) {
|
if (scheme_system_children) {
|
||||||
|
@ -6511,15 +6511,11 @@ int scheme_check_child_done()
|
||||||
prev->next = sc->next;
|
prev->next = sc->next;
|
||||||
} else
|
} else
|
||||||
scheme_system_children = sc->next;
|
scheme_system_children = sc->next;
|
||||||
|
|
||||||
did_one = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (result > 0);
|
} while (result > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return did_one;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6679,6 +6675,7 @@ static int subp_done(Scheme_Object *sp)
|
||||||
|
|
||||||
#if defined(UNIX_PROCESSES)
|
#if defined(UNIX_PROCESSES)
|
||||||
System_Child *sc = (System_Child *)sci;
|
System_Child *sc = (System_Child *)sci;
|
||||||
|
check_child_done();
|
||||||
return sc->done;
|
return sc->done;
|
||||||
#endif
|
#endif
|
||||||
#ifdef WINDOWS_PROCESSES
|
#ifdef WINDOWS_PROCESSES
|
||||||
|
@ -6717,6 +6714,8 @@ static Scheme_Object *subprocess_status(int argc, Scheme_Object **argv)
|
||||||
#if defined(UNIX_PROCESSES)
|
#if defined(UNIX_PROCESSES)
|
||||||
System_Child *sc = (System_Child *)sp->handle;
|
System_Child *sc = (System_Child *)sp->handle;
|
||||||
|
|
||||||
|
check_child_done();
|
||||||
|
|
||||||
if (sc->done)
|
if (sc->done)
|
||||||
status = sc->status;
|
status = sc->status;
|
||||||
else
|
else
|
||||||
|
@ -6789,6 +6788,8 @@ static Scheme_Object *subprocess_kill(int argc, Scheme_Object **argv)
|
||||||
{
|
{
|
||||||
System_Child *sc = (System_Child *)sp->handle;
|
System_Child *sc = (System_Child *)sp->handle;
|
||||||
|
|
||||||
|
check_child_done();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (sc->done)
|
if (sc->done)
|
||||||
return scheme_void;
|
return scheme_void;
|
||||||
|
|
|
@ -95,10 +95,6 @@ extern HANDLE scheme_break_semaphore;
|
||||||
|
|
||||||
#include "schfd.h"
|
#include "schfd.h"
|
||||||
|
|
||||||
#if defined(UNIX_PROCESSES)
|
|
||||||
extern int scheme_check_child_done();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEFAULT_INIT_STACK_SIZE 1000
|
#define DEFAULT_INIT_STACK_SIZE 1000
|
||||||
#define MAX_INIT_STACK_SIZE 100000
|
#define MAX_INIT_STACK_SIZE 100000
|
||||||
|
|
||||||
|
@ -3458,11 +3454,6 @@ static int check_sleep(int need_activity, int sleep_now)
|
||||||
if (needs_sleep_cancelled)
|
if (needs_sleep_cancelled)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if defined(UNIX_PROCESSES)
|
|
||||||
if (scheme_check_child_done())
|
|
||||||
return 0;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
if (post_system_idle()) {
|
if (post_system_idle()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3859,10 +3850,6 @@ void scheme_thread_block(float sleep_time)
|
||||||
/* Check scheduled_kills early and often. */
|
/* Check scheduled_kills early and often. */
|
||||||
check_scheduled_kills();
|
check_scheduled_kills();
|
||||||
|
|
||||||
#if defined(UNIX_PROCESSES)
|
|
||||||
scheme_check_child_done();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!do_atomic && (sleep_end >= 0.0)) {
|
if (!do_atomic && (sleep_end >= 0.0)) {
|
||||||
double msecs = 0.0;
|
double msecs = 0.0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user