refactor: sandbox struct in req queue

master
Sean McBride 3 years ago
parent ee760577ed
commit 362bf39047

@ -5,7 +5,7 @@
#include "sandbox_types.h"
/* Returns pointer back if successful, null otherwise */
typedef struct sandbox *(*global_request_scheduler_add_fn_t)(void *);
typedef struct sandbox *(*global_request_scheduler_add_fn_t)(struct sandbox *);
typedef int (*global_request_scheduler_remove_fn_t)(struct sandbox **);
typedef int (*global_request_scheduler_remove_if_earlier_fn_t)(struct sandbox **, uint64_t);
typedef uint64_t (*global_request_scheduler_peek_fn_t)(void);

@ -5,7 +5,7 @@
/* Default uninitialized implementations of the polymorphic interface */
noreturn static struct sandbox *
uninitialized_add(void *arg)
uninitialized_add(struct sandbox *arg)
{
panic("Global Request Scheduler Add was called before initialization\n");
}

@ -15,16 +15,16 @@ static struct priority_queue *global_request_scheduler_minheap;
* @returns pointer to request if added. Panics runtime otherwise
*/
static struct sandbox *
global_request_scheduler_minheap_add(void *sandbox_raw)
global_request_scheduler_minheap_add(struct sandbox *sandbox)
{
assert(sandbox_raw);
assert(sandbox);
assert(global_request_scheduler_minheap);
if (unlikely(!listener_thread_is_running())) panic("%s is only callable by the listener thread\n", __func__);
int return_code = priority_queue_enqueue(global_request_scheduler_minheap, sandbox_raw);
int return_code = priority_queue_enqueue(global_request_scheduler_minheap, sandbox);
/* TODO: Propagate -1 to caller. Issue #91 */
if (return_code == -ENOSPC) panic("Request Queue is full\n");
return (struct sandbox *)sandbox_raw;
return sandbox;
}
/**

Loading…
Cancel
Save