diff --git a/runtime/include/local_runqueue.h b/runtime/include/local_runqueue.h index dace39e..f0714dc 100644 --- a/runtime/include/local_runqueue.h +++ b/runtime/include/local_runqueue.h @@ -5,7 +5,7 @@ #include "sandbox.h" /* Returns pointer back if successful, null otherwise */ -typedef struct sandbox *(*local_runqueue_add_fn_t)(struct sandbox *); +typedef void (*local_runqueue_add_fn_t)(struct sandbox *); typedef bool (*local_runqueue_is_empty_fn_t)(void); typedef void (*local_runqueue_delete_fn_t)(struct sandbox *sandbox); typedef struct sandbox *(*local_runqueue_get_next_fn_t)(); @@ -22,7 +22,7 @@ struct local_runqueue_config { void local_runqueue_initialize(struct local_runqueue_config *config); /* This is currently only used by worker_thread_wakeup_sandbox */ -struct sandbox *local_runqueue_add(struct sandbox *); +void local_runqueue_add(struct sandbox *); void local_runqueue_delete(struct sandbox *); bool local_runqueue_is_empty(); struct sandbox *local_runqueue_get_next(); diff --git a/runtime/include/panic.h b/runtime/include/panic.h index 167f632..3a4227f 100644 --- a/runtime/include/panic.h +++ b/runtime/include/panic.h @@ -11,5 +11,5 @@ panic(const char *format, ...) va_start(args, format); vfprintf(stderr, format, args); va_end(args); - exit(EXIT_FAILURE); + assert(0); } \ No newline at end of file diff --git a/runtime/src/local_runqueue.c b/runtime/src/local_runqueue.c index 3983c7e..5d61446 100644 --- a/runtime/src/local_runqueue.c +++ b/runtime/src/local_runqueue.c @@ -12,9 +12,8 @@ local_runqueue_initialize(struct local_runqueue_config *config) /** * Adds a sandbox request to the run queue * @param sandbox to add - * @returns sandbox that was added (or NULL?) */ -struct sandbox * +void local_runqueue_add(struct sandbox *sandbox) { assert(local_runqueue.add_fn != NULL); diff --git a/runtime/src/local_runqueue_list.c b/runtime/src/local_runqueue_list.c index 0fc6dcf..e9d6a6c 100644 --- a/runtime/src/local_runqueue_list.c +++ b/runtime/src/local_runqueue_list.c @@ -68,14 +68,13 @@ local_runqueue_list_get_next() * Append a sandbox to the runqueue * @returns the appended sandbox */ -struct sandbox * +void local_runqueue_list_append(struct sandbox *sandbox_to_append) { assert(ps_list_singleton_d(sandbox_to_append)); // fprintf(stderr, "(%d,%lu) %s: run %p, %s\n", sched_getcpu(), pthread_self(), __func__, s, // s->module->name); ps_list_head_append_d(&local_runqueue_list, sandbox_to_append); - return sandbox_to_append; } /** diff --git a/runtime/src/local_runqueue_minheap.c b/runtime/src/local_runqueue_minheap.c index f0e9bc2..581403a 100644 --- a/runtime/src/local_runqueue_minheap.c +++ b/runtime/src/local_runqueue_minheap.c @@ -25,25 +25,18 @@ local_runqueue_minheap_is_empty() /** * Adds a sandbox to the run queue * @param sandbox - * @returns pointer to request if added. NULL otherwise + * @returns pointer to sandbox added */ -static struct sandbox * +void local_runqueue_minheap_add(struct sandbox *sandbox) { int original_length = priority_queue_length(&local_runqueue_minheap); int return_code = priority_queue_enqueue(&local_runqueue_minheap, sandbox, "Runqueue"); - if (return_code == -1) { - printf("Thread Runqueue is full!\n"); - exit(EXIT_FAILURE); - } + if (return_code == -1) panic("Thread Runqueue is full!\n"); - int final_length = priority_queue_length(&local_runqueue_minheap); - - assert(final_length == original_length + 1); - - assert(return_code == 0); - return sandbox; + /* Assumption: Should always take lock because thread-local runqueue */ + assert(return_code != -2); } /**