|
|
@ -109,7 +109,7 @@ sigalrm_propagate_workers(siginfo_t *signal_info)
|
|
|
|
static inline void
|
|
|
|
static inline void
|
|
|
|
sigint_propagate_workers_listener(siginfo_t *signal_info)
|
|
|
|
sigint_propagate_workers_listener(siginfo_t *signal_info)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Signal was sent directly by the kernel, so forward to other threads */
|
|
|
|
/* Signal was sent directly by the kernel user space, so forward to other threads */
|
|
|
|
if (signal_info->si_code == SI_KERNEL || signal_info->si_code == SI_USER) {
|
|
|
|
if (signal_info->si_code == SI_KERNEL || signal_info->si_code == SI_USER) {
|
|
|
|
for (int i = 0; i < runtime_worker_threads_count; i++) {
|
|
|
|
for (int i = 0; i < runtime_worker_threads_count; i++) {
|
|
|
|
if (pthread_self() == runtime_worker_threads[i]) continue;
|
|
|
|
if (pthread_self() == runtime_worker_threads[i]) continue;
|
|
|
@ -178,7 +178,7 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
|
|
|
|
atomic_fetch_add(&software_interrupt_deferred_sigalrm, 1);
|
|
|
|
atomic_fetch_add(&software_interrupt_deferred_sigalrm, 1);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
/* A worker thread received a SIGALRM while running a preemptable sandbox, so preempt */
|
|
|
|
/* A worker thread received a SIGALRM while running a preemptable sandbox, so preempt */
|
|
|
|
assert(current_sandbox->state == SANDBOX_RUNNING);
|
|
|
|
//assert(current_sandbox->state == SANDBOX_RUNNING);
|
|
|
|
scheduler_preempt(user_context);
|
|
|
|
scheduler_preempt(user_context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goto done;
|
|
|
|
goto done;
|
|
|
@ -186,7 +186,6 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
|
|
|
|
case SIGUSR1: {
|
|
|
|
case SIGUSR1: {
|
|
|
|
assert(current_sandbox);
|
|
|
|
assert(current_sandbox);
|
|
|
|
assert(current_sandbox->ctxt.variant == ARCH_CONTEXT_VARIANT_SLOW);
|
|
|
|
assert(current_sandbox->ctxt.variant == ARCH_CONTEXT_VARIANT_SLOW);
|
|
|
|
|
|
|
|
|
|
|
|
atomic_fetch_add(&software_interrupt_SIGUSR_count, 1);
|
|
|
|
atomic_fetch_add(&software_interrupt_SIGUSR_count, 1);
|
|
|
|
#ifdef LOG_PREEMPTION
|
|
|
|
#ifdef LOG_PREEMPTION
|
|
|
|
debuglog("Total SIGUSR1 Received: %d\n", software_interrupt_SIGUSR_count);
|
|
|
|
debuglog("Total SIGUSR1 Received: %d\n", software_interrupt_SIGUSR_count);
|
|
|
@ -197,7 +196,7 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
|
|
|
|
goto done;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case SIGINT: {
|
|
|
|
case SIGINT: {
|
|
|
|
/* Only the thread that receives SIGINT from the kernel will broadcast SIGINT to other worker threads */
|
|
|
|
/* Only the thread that receives SIGINT from the kernel or user space will broadcast SIGINT to other worker threads */
|
|
|
|
sigint_propagate_workers_listener(signal_info);
|
|
|
|
sigint_propagate_workers_listener(signal_info);
|
|
|
|
dump_log_to_file();
|
|
|
|
dump_log_to_file();
|
|
|
|
/* terminate itself */
|
|
|
|
/* terminate itself */
|
|
|
|