Stop waiting for an event if a signal occured.

This commit is contained in:
mainzelm 2002-02-06 17:18:15 +00:00
parent 3ce5de8758
commit a1bf0f0792
1 changed files with 16 additions and 2 deletions

View File

@ -28,6 +28,8 @@ static void when_sigpipe_interrupt();
/* JMG:*/
static void when_scsh_interrupt();
/* JMG: for scsh */
static long interrupt_count[32];
bool s48_setcatcher(int signum, void (*catcher)(int));
@ -562,6 +564,8 @@ s48_wait_for_event(long max_wait, bool is_minutes)
}
if (keyboard_interrupt_count > 0)
status = NO_ERRORS;
else if (s48_os_signal_happend ())
status = NO_ERRORS;
else {
status = queue_ready_ports(TRUE, seconds, ticks);
if (there_are_ready_ports())
@ -644,8 +648,6 @@ queue_ready_ports(bool wait, long seconds, long ticks)
/* JMG: for scsh */
static long interrupt_count[32];
static void when_scsh_interrupt(int signo)
{
interrupt_count[sig2int[signo]] +=1;
@ -691,3 +693,15 @@ s48_os_signal_pending(void) {
}
return FALSE;
}
int
s48_os_signal_happend(void) {
int i;
for (i = 0; i < max_sig; i++){
if (interrupt_count[i] > 0){
return 1;
}
}
return 0;
}