fix scheduler related to subprocesses

svn: r9240
This commit is contained in:
Matthew Flatt 2008-04-10 20:14:47 +00:00
parent 0153e122b7
commit 34aea6f7ad
3 changed files with 17 additions and 6 deletions

View File

@ -403,6 +403,8 @@ Scheme_Env *scheme_basic_env()
scheme_starting_up = 0; scheme_starting_up = 0;
--scheme_current_thread->suspend_break; /* created with breaks suspended */
#ifdef TIME_STARTUP_PROCESS #ifdef TIME_STARTUP_PROCESS
printf("done @ %ld\n#endif\n", scheme_get_process_milliseconds()); printf("done @ %ld\n#endif\n", scheme_get_process_milliseconds());
#endif #endif

View File

@ -6483,10 +6483,10 @@ static void init_sigchld(void)
} }
} }
void scheme_check_child_done() int scheme_check_child_done()
{ {
pid_t result; pid_t result;
int status; int status, did_one = 0;
System_Child *sc, *prev; System_Child *sc, *prev;
if (scheme_system_children) { if (scheme_system_children) {
@ -6512,12 +6512,14 @@ void scheme_check_child_done()
} else } else
scheme_system_children = sc->next; scheme_system_children = sc->next;
break; did_one = 1;
} }
} }
} }
} while (result > 0); } while (result > 0);
} }
return did_one;
} }
#endif #endif
@ -7980,7 +7982,10 @@ void scheme_signal_received(void)
{ {
#if defined(FILES_HAVE_FDS) #if defined(FILES_HAVE_FDS)
if (put_external_event_fd) { if (put_external_event_fd) {
write(put_external_event_fd, "!", 1); int v;
do {
v = write(put_external_event_fd, "!", 1);
} while ((v == -1) && (errno == EINTR));
} }
#endif #endif
#if defined(WINDOWS_PROCESSES) || defined(WINDOWS_FILE_HANDLES) #if defined(WINDOWS_PROCESSES) || defined(WINDOWS_FILE_HANDLES)

View File

@ -96,7 +96,7 @@ extern HANDLE scheme_break_semaphore;
#include "schfd.h" #include "schfd.h"
#if defined(UNIX_PROCESSES) #if defined(UNIX_PROCESSES)
extern void scheme_check_child_done(); extern int scheme_check_child_done();
#endif #endif
#define DEFAULT_INIT_STACK_SIZE 1000 #define DEFAULT_INIT_STACK_SIZE 1000
@ -2093,6 +2093,8 @@ static Scheme_Thread *make_thread(Scheme_Config *config,
process->prev = NULL; process->prev = NULL;
process->next = NULL; process->next = NULL;
process->suspend_break = 1; /* until start-up finished */
process->error_buf = &main_init_error_buf; process->error_buf = &main_init_error_buf;
thread_swap_callbacks = scheme_null; thread_swap_callbacks = scheme_null;
@ -2175,7 +2177,6 @@ static Scheme_Thread *make_thread(Scheme_Config *config,
process->current_local_env = NULL; process->current_local_env = NULL;
process->suspend_break = 0;
process->external_break = 0; process->external_break = 0;
process->ran_some = 1; process->ran_some = 1;
@ -3457,6 +3458,9 @@ static int check_sleep(int need_activity, int sleep_now)
if (needs_sleep_cancelled) if (needs_sleep_cancelled)
return 0; return 0;
if (scheme_check_child_done())
return 0;
if (post_system_idle()) { if (post_system_idle()) {
return 0; return 0;
} }