refactor: additional cleanup

main
Sean McBride 4 years ago
parent 85856148e1
commit 758a1425b5

@ -348,10 +348,10 @@ main(int argc, char **argv)
runtime_allocate_available_cores(); runtime_allocate_available_cores();
runtime_configure(); runtime_configure();
runtime_initialize(); runtime_initialize();
software_interrupt_initialize();
listener_thread_initialize(); listener_thread_initialize();
runtime_start_runtime_worker_threads(); runtime_start_runtime_worker_threads();
software_interrupt_initialize();
software_interrupt_arm_timer(); software_interrupt_arm_timer();
#ifdef LOG_MODULE_LOADING #ifdef LOG_MODULE_LOADING

@ -101,9 +101,6 @@ runtime_initialize(void)
/* Configure Signals */ /* Configure Signals */
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
signal(SIGTERM, runtime_cleanup); signal(SIGTERM, runtime_cleanup);
/* These should only be unmasked by workers */
software_interrupt_mask_signal(SIGUSR1);
software_interrupt_mask_signal(SIGALRM);
http_parser_settings_initialize(); http_parser_settings_initialize();
admissions_control_initialize(); admissions_control_initialize();

@ -7,9 +7,7 @@
#include "debuglog.h" #include "debuglog.h"
#include "sandbox_state.h" #include "sandbox_state.h"
// TODO: Double check this
const bool sandbox_state_is_terminal[SANDBOX_STATE_COUNT] = { const bool sandbox_state_is_terminal[SANDBOX_STATE_COUNT] = {
[SANDBOX_UNINITIALIZED] = false, [SANDBOX_ALLOCATED] = false, [SANDBOX_INITIALIZED] = true, [SANDBOX_UNINITIALIZED] = false, [SANDBOX_ALLOCATED] = false, [SANDBOX_INITIALIZED] = true,
[SANDBOX_SET_AS_RUNNABLE] = false, [SANDBOX_RUNNABLE] = true, [SANDBOX_SET_AS_RUNNING] = false, [SANDBOX_SET_AS_RUNNABLE] = false, [SANDBOX_RUNNABLE] = true, [SANDBOX_SET_AS_RUNNING] = false,
[SANDBOX_RUNNING] = true, [SANDBOX_SET_AS_BLOCKED] = false, [SANDBOX_BLOCKED] = true, [SANDBOX_RUNNING] = true, [SANDBOX_SET_AS_BLOCKED] = false, [SANDBOX_BLOCKED] = true,

@ -25,7 +25,6 @@
* Process Globals * * Process Globals *
******************/ ******************/
static const int software_interrupt_supported_signals[] = { SIGALRM, SIGUSR1 };
static uint64_t software_interrupt_interval_duration_in_cycles; static uint64_t software_interrupt_interval_duration_in_cycles;
/****************** /******************
@ -284,18 +283,18 @@ software_interrupt_initialize(void)
signal_action.sa_flags = SA_SIGINFO | SA_RESTART; signal_action.sa_flags = SA_SIGINFO | SA_RESTART;
/* all threads created by the calling thread will have signal blocked */ /* all threads created by the calling thread will have signal blocked */
/* TODO: What does sa_mask do? I have to call software_interrupt_mask_signal below */
// TODO: Unclear about this...
sigemptyset(&signal_action.sa_mask); sigemptyset(&signal_action.sa_mask);
// sigaddset(&signal_action.sa_mask, SIGALRM); sigaddset(&signal_action.sa_mask, SIGALRM);
// sigaddset(&signal_action.sa_mask, SIGUSR1); sigaddset(&signal_action.sa_mask, SIGUSR1);
for (int i = 0; const int supported_signals[] = { SIGALRM, SIGUSR1 };
i < (sizeof(software_interrupt_supported_signals) / sizeof(software_interrupt_supported_signals[0])); const size_t supported_signals_len = 2;
i++) {
// TODO: Setup masks for (int i = 0; i < supported_signals_len; i++) {
int return_code = sigaction(software_interrupt_supported_signals[i], &signal_action, NULL); int signal = supported_signals[i];
if (return_code) { software_interrupt_mask_signal(signal);
if (sigaction(signal, &signal_action, NULL)) {
perror("sigaction"); perror("sigaction");
exit(1); exit(1);
} }

Loading…
Cancel
Save