diff --git a/harness.c b/harness.c index 0f9b691..3339c18 100644 --- a/harness.c +++ b/harness.c @@ -33,6 +33,7 @@ typedef unsigned char u_char; # error Define STACK_SIZE for your platform. It should probably not be less than 32k? #endif +static volatile int harness_running = 1; Process *current_process = NULL; #define EMPTY_PROCESS_QUEUE ((queue_t) { offsetof(Process, link), 0, NULL, NULL }) @@ -234,7 +235,13 @@ void boot_harness(void) { //info("Polling for events\n"); event_loop(EVLOOP_NONBLOCK); } + if (!harness_running) break; //info("Blocking for events\n"); event_loop(EVLOOP_ONCE); } } + +void interrupt_harness(void) { + info("Interrupting harness\n"); + harness_running = 0; +} diff --git a/harness.h b/harness.h index 7f30309..7926e0b 100644 --- a/harness.h +++ b/harness.h @@ -41,5 +41,6 @@ extern int iohandle_flush(IOHandle *h); extern void iohandle_settimeout(IOHandle *h, int timeout_read, int timeout_write); extern void boot_harness(void); +extern void interrupt_harness(void); #endif