forked from haiwan/sledge
parent
f8d74bdfed
commit
403b167a7e
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef SFRT_SANDBOX_RUN_QUEUE_H
|
||||||
|
#define SFRT_SANDBOX_RUN_QUEUE_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "sandbox.h"
|
||||||
|
|
||||||
|
void sandbox_run_queue_initialize();
|
||||||
|
|
||||||
|
bool sandbox_run_queue_is_empty();
|
||||||
|
|
||||||
|
// Get the sandbox at the head of the thread local runqueue
|
||||||
|
struct sandbox *sandbox_run_queue_get_head();
|
||||||
|
|
||||||
|
// Remove a sandbox from the runqueue
|
||||||
|
void sandbox_run_queue_remove(struct sandbox *sandbox_to_remove);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append the sandbox to the worker_thread_run_queue
|
||||||
|
* @param sandbox_to_append
|
||||||
|
*/
|
||||||
|
void sandbox_run_queue_append(struct sandbox *sandbox_to_append);
|
||||||
|
|
||||||
|
#endif /* SFRT_SANDBOX_RUN_QUEUE_H */
|
@ -0,0 +1,39 @@
|
|||||||
|
#include "sandbox_run_queue.h"
|
||||||
|
|
||||||
|
__thread static struct ps_list_head sandbox_run_queue;
|
||||||
|
|
||||||
|
void
|
||||||
|
sandbox_run_queue_initialize()
|
||||||
|
{
|
||||||
|
ps_list_head_init(&sandbox_run_queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
sandbox_run_queue_is_empty()
|
||||||
|
{
|
||||||
|
return ps_list_head_empty(&sandbox_run_queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the sandbox at the head of the thread local runqueue
|
||||||
|
struct sandbox *
|
||||||
|
sandbox_run_queue_get_head()
|
||||||
|
{
|
||||||
|
return ps_list_head_first_d(&sandbox_run_queue, struct sandbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove a sandbox from the runqueue
|
||||||
|
void
|
||||||
|
sandbox_run_queue_remove(struct sandbox *sandbox_to_remove)
|
||||||
|
{
|
||||||
|
ps_list_rem_d(sandbox_to_remove);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append a sandbox to the runqueue
|
||||||
|
void
|
||||||
|
sandbox_run_queue_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(&sandbox_run_queue, sandbox_to_append);
|
||||||
|
}
|
Loading…
Reference in new issue