chore: simplify RCs

main
Sean McBride 4 years ago
parent 41f63ebafc
commit 080c3d6656

@ -14,12 +14,7 @@ struct global_request_scheduler_config {
};
void global_request_scheduler_initialize(struct global_request_scheduler_config *config);
#define GLOBAL_REQUEST_SCHEDULER_REMOVE_OK 0
#define GLOBAL_REQUEST_SCHEDULER_REMOVE_EMPTY -1
#define GLOBAL_REQUEST_SCHEDULER_REMOVE_NOLOCK -2
void global_request_scheduler_initialize(struct global_request_scheduler_config *config);
struct sandbox_request *global_request_scheduler_add(struct sandbox_request *);
int global_request_scheduler_remove(struct sandbox_request **);
uint64_t global_request_scheduler_peek();

@ -47,7 +47,7 @@ local_runqueue_list_get_next()
// If our local runqueue is empty, try to pull and allocate a sandbox request from the global request scheduler
if (local_runqueue_is_empty()) {
if (global_request_scheduler_remove(&sandbox_request) != GLOBAL_REQUEST_SCHEDULER_REMOVE_OK) goto err;
if (global_request_scheduler_remove(&sandbox_request) < 0) goto err;
struct sandbox *sandbox = sandbox_allocate(sandbox_request);
if (!sandbox) goto sandbox_allocate_err;

@ -87,7 +87,7 @@ local_runqueue_minheap_get_next()
local_runqueue_minheap_add(sandbox);
} else if (sandbox_rc == -1) {
/* local runqueue was empty, try to pull a sandbox request and return NULL if we're unable to get one */
if (global_request_scheduler_remove(&sandbox_request) != GLOBAL_REQUEST_SCHEDULER_REMOVE_OK) goto err;
if (global_request_scheduler_remove(&sandbox_request) < 0) goto err;
/* Try to allocate a sandbox, returning the request on failure */
sandbox = sandbox_allocate(sandbox_request);

Loading…
Cancel
Save