chore: rename nested namespaces pending refactor

main
Sean McBride 5 years ago
parent 2640f3a44f
commit 3cbb7f0748

@ -85,10 +85,10 @@ extern __thread struct sandbox *worker_thread__current_sandbox;
extern __thread arch_context_t *worker_thread__next_context; extern __thread arch_context_t *worker_thread__next_context;
extern void worker_thread__block_current_sandbox(void); extern void worker_thread__block_current_sandbox(void);
extern void worker_thread__completion_queue__add_sandbox(struct sandbox *sandbox); extern void worker_thread__exit_current_sandbox(void);
extern void worker_thread__current_sandbox__exit(void);
extern struct sandbox *worker_thread__get_next_sandbox(int interrupt); extern struct sandbox *worker_thread__get_next_sandbox(int interrupt);
extern void worker_thread__process_io(void); extern void worker_thread__process_io(void);
extern void worker_thread__push_sandbox_to_completion_queue(struct sandbox *sandbox);
extern void __attribute__((noreturn)) worker_thread__sandbox_switch_preempt(void); extern void __attribute__((noreturn)) worker_thread__sandbox_switch_preempt(void);
extern void worker_thread__wakeup_sandbox(sandbox_t *sandbox); extern void worker_thread__wakeup_sandbox(sandbox_t *sandbox);

@ -166,7 +166,7 @@ static __thread unsigned int worker_thread__is_in_callback;
* Worker Thread Logic * Worker Thread Logic
*************************************************/ *************************************************/
static inline void worker_thread__run_queue__add_sandbox(struct sandbox *sandbox); static inline void worker_thread__push_sandbox_to_run_queue(struct sandbox *sandbox);
/** /**
* @brief Switches to the next sandbox, placing the current sandbox of the completion queue if in RETURNED state * @brief Switches to the next sandbox, placing the current sandbox of the completion queue if in RETURNED state
@ -183,7 +183,7 @@ worker_thread__switch_to_sandbox(struct sandbox *next_sandbox)
current_sandbox__set(next_sandbox); current_sandbox__set(next_sandbox);
// If the current sandbox we're switching from is in a RETURNED state, add to completion queue // If the current sandbox we're switching from is in a RETURNED state, add to completion queue
if (current_sandbox && current_sandbox->state == RETURNED) if (current_sandbox && current_sandbox->state == RETURNED)
worker_thread__completion_queue__add_sandbox(current_sandbox); worker_thread__push_sandbox_to_completion_queue(current_sandbox);
worker_thread__next_context = next_register_context; worker_thread__next_context = next_register_context;
arch_context_switch(current_register_context, next_register_context); arch_context_switch(current_register_context, next_register_context);
software_interrupt__enable(); software_interrupt__enable();
@ -283,7 +283,7 @@ worker_thread__pull_and_process_sandbox_requests(void)
free(sandbox_request); free(sandbox_request);
// Set the sandbox as runnable and place on the local runqueue // Set the sandbox as runnable and place on the local runqueue
sandbox->state = RUNNABLE; sandbox->state = RUNNABLE;
worker_thread__run_queue__add_sandbox(sandbox); worker_thread__push_sandbox_to_run_queue(sandbox);
total_sandboxes_pulled++; total_sandboxes_pulled++;
} }
@ -310,7 +310,7 @@ worker_thread__execute_libuv_event_loop(void)
* @param sandbox sandbox to add * @param sandbox sandbox to add
*/ */
static inline void static inline void
worker_thread__run_queue__add_sandbox(struct sandbox *sandbox) worker_thread__push_sandbox_to_run_queue(struct sandbox *sandbox)
{ {
assert(ps_list_singleton_d(sandbox)); assert(ps_list_singleton_d(sandbox));
// fprintf(stderr, "(%d,%lu) %s: run %p, %s\n", sched_getcpu(), pthread_self(), __func__, s, // fprintf(stderr, "(%d,%lu) %s: run %p, %s\n", sched_getcpu(), pthread_self(), __func__, s,
@ -323,7 +323,7 @@ worker_thread__run_queue__add_sandbox(struct sandbox *sandbox)
* @param sandbox sandbox * @param sandbox sandbox
**/ **/
static inline void static inline void
worker_thread__run_queue__remove_sandbox(struct sandbox *sandbox) worker_thread__pop_sandbox_from_run_queue(struct sandbox *sandbox)
{ {
ps_list_rem_d(sandbox); ps_list_rem_d(sandbox);
} }
@ -365,7 +365,7 @@ worker_thread__get_next_sandbox(int in_interrupt)
* @param sandbox * @param sandbox
**/ **/
void void
worker_thread__completion_queue__add_sandbox(struct sandbox *sandbox) worker_thread__push_sandbox_to_completion_queue(struct sandbox *sandbox)
{ {
assert(ps_list_singleton_d(sandbox)); assert(ps_list_singleton_d(sandbox));
ps_list_head_append_d(&worker_thread__completion_queue, sandbox); ps_list_head_append_d(&worker_thread__completion_queue, sandbox);
@ -373,12 +373,12 @@ worker_thread__completion_queue__add_sandbox(struct sandbox *sandbox)
/** /**
* @brief Remove and free n sandboxes from the thread local completion queue * @brief Pops n sandboxes from the thread local completion queue and then frees them
* @param number_to_free The number of sandboxes to free * @param number_to_free The number of sandboxes to pop and free
* @return void * @return void
*/ */
static inline void static inline void
worker_thread__completion_queue__free_sandboxes(unsigned int number_to_free) worker_thread__pop_and_free_n_sandboxes_from_completion_queue(unsigned int number_to_free)
{ {
for (int i = 0; i < number_to_free; i++) { for (int i = 0; i < number_to_free; i++) {
if (ps_list_head_empty(&worker_thread__completion_queue)) break; if (ps_list_head_empty(&worker_thread__completion_queue)) break;
@ -399,7 +399,7 @@ worker_thread__execute_runtime_maintenance_and_get_next_sandbox(void)
{ {
assert(current_sandbox__get() == NULL); assert(current_sandbox__get() == NULL);
// Try to free one sandbox from the completion queue // Try to free one sandbox from the completion queue
worker_thread__completion_queue__free_sandboxes(1); worker_thread__pop_and_free_n_sandboxes_from_completion_queue(1);
// Execute libuv callbacks // Execute libuv callbacks
if (!worker_thread__is_in_callback) worker_thread__execute_libuv_event_loop(); if (!worker_thread__is_in_callback) worker_thread__execute_libuv_event_loop();
@ -451,12 +451,12 @@ worker_thread__main(void *return_code)
* TODO: Consider moving this to a future current_sandbox file. This has thus far proven difficult to move * TODO: Consider moving this to a future current_sandbox file. This has thus far proven difficult to move
**/ **/
void void
worker_thread__current_sandbox__exit(void) worker_thread__exit_current_sandbox(void)
{ {
struct sandbox *current_sandbox = current_sandbox__get(); struct sandbox *current_sandbox = current_sandbox__get();
assert(current_sandbox); assert(current_sandbox);
software_interrupt__disable(); software_interrupt__disable();
worker_thread__run_queue__remove_sandbox(current_sandbox); worker_thread__pop_sandbox_from_run_queue(current_sandbox);
current_sandbox->state = RETURNED; current_sandbox->state = RETURNED;
struct sandbox *next_sandbox = worker_thread__get_next_sandbox(0); struct sandbox *next_sandbox = worker_thread__get_next_sandbox(0);

@ -250,7 +250,7 @@ current_sandbox__main(void)
#else #else
close(current_sandbox->client_socket_descriptor); close(current_sandbox->client_socket_descriptor);
#endif #endif
worker_thread__current_sandbox__exit(); worker_thread__exit_current_sandbox();
} }
/** /**

Loading…
Cancel
Save