noreturn int shim_do_exit_group (int error_code) { INC_PROFILE_OCCURENCE(syscall_use_ipc); struct shim_thread * cur_thread = get_cur_thread(); assert(!is_internal(cur_thread)); if (debug_handle) sysparser_printf("---- shim_exit_group (returning %d)\n", error_code); if (cur_thread->dummy) { cur_thread->term_signal = 0; thread_exit(cur_thread, true); switch_dummy_thread(cur_thread); } debug("now kill other threads in the process\n"); do_kill_proc(cur_thread->tgid, cur_thread->tgid, SIGKILL, false); debug("now exit the process\n"); try_process_exit(error_code, 0); #ifdef PROFILE if (ENTER_TIME) SAVE_PROFILE_INTERVAL_SINCE(syscall_exit_group, ENTER_TIME); #endif DkThreadExit(); }
int thread_1(void* args) { DkThreadDelayExecution(1000); pal_printf("In Thread 1\n"); while (count < 100) count++; DkEventSet(event1); DkThreadExit(); return 0; }
static void sighandler_kill (int sig, siginfo_t * info, void * ucontext) { if (sig <= NUM_KNOWN_SIGS) debug("killed by %s\n", siglist[sig]); else debug("killed by signal %d\n", sig); if (!info->si_pid) switch(sig) { case SIGTERM: case SIGINT: shim_do_kill(-1, sig); break; } try_process_exit(0); DkThreadExit(); }
int try_process_exit (int error_code, int term_signal) { struct shim_thread * cur_thread = get_cur_thread(); cur_thread->exit_code = -error_code; cur_process.exit_code = error_code; cur_thread->term_signal = term_signal; if (cur_thread->in_vm) thread_exit(cur_thread, true); if (check_last_thread(cur_thread)) return 0; struct shim_thread * async_thread = terminate_async_helper(); if (async_thread) /* TODO: wait for the thread to exit in host. * This is tracked by the following issue. * https://github.com/oscarlab/graphene/issues/440 */ put_thread(async_thread); /* free resources of the thread */ struct shim_thread * ipc_thread; int ret = exit_with_ipc_helper(true, &ipc_thread); if (ipc_thread) /* TODO: wait for the thread to exit in host. * This is tracked by the following issue. * https://github.com/oscarlab/graphene/issues/440 */ put_thread(ipc_thread); /* free resources of the thread */ if (!ret) shim_clean(ret); else DkThreadExit(); return 0; }
noreturn int shim_do_exit (int error_code) { INC_PROFILE_OCCURENCE(syscall_use_ipc); struct shim_thread * cur_thread = get_cur_thread(); assert(!is_internal(cur_thread)); if (debug_handle) sysparser_printf("---- shim_exit (returning %d)\n", error_code); if (cur_thread->dummy) { cur_thread->term_signal = 0; thread_exit(cur_thread, true); switch_dummy_thread(cur_thread); } try_process_exit(error_code, 0); #ifdef PROFILE if (ENTER_TIME) SAVE_PROFILE_INTERVAL_SINCE(syscall_exit, ENTER_TIME); #endif DkThreadExit(); }