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_configure();
runtime_initialize();
software_interrupt_initialize();
listener_thread_initialize();
runtime_start_runtime_worker_threads();
software_interrupt_initialize();
software_interrupt_arm_timer();
#ifdef LOG_MODULE_LOADING

@ -101,9 +101,6 @@ runtime_initialize(void)
/* Configure Signals */
signal(SIGPIPE, SIG_IGN);
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();
admissions_control_initialize();

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

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

Loading…
Cancel
Save