_Noreturn void exit_server(int retcode) { int err; interrupted = true; cleanup_ipc(); lock_mutex(&counter_mutex); while(alive_threads > 0) if(0 != (err = pthread_cond_wait(&finish_cond, &counter_mutex))) serv_error("Unable to wait on finish_cond: %d", err); unlock_mutex(&counter_mutex); // mutexes, conditional variables and rwlocks are not destroyed, // because the main thread may possiby be blocked on it while handling // the signal and destroying mutexes/conds/rwlocks while they are used // results is undefined behaviour. Nevertheless, from now on we are sure // to have just one thread if(results) for(int i = 0; i < L; ++i) free((void *) results[i]); free((void*) results); free((void*) stations); exit(retcode ? EXIT_FAILURE : EXIT_SUCCESS); }
void tst_vbrk_(const char *file, const int lineno, int ttype, const char *fmt, va_list va) { print_result(file, lineno, ttype, fmt, va); if (getpid() == main_pid) { do_cleanup(); cleanup_ipc(); } exit(TTYPE_RESULT(ttype)); }
void cleanup(int err) { #ifndef XAW if(HasDialog>0) kill(HasDialog,SIGINT); cleanup_ipc(); if (!script && !xbreak) x_screen_close(); #endif CleanRAMDev("RAM"); exit(err); }
static void do_cleanup(void) { if (mntpoint_mounted) tst_umount(tst_test->mntpoint); if (tst_test->needs_device && tdev.dev) tst_release_device(tdev.dev); if (tst_tmpdir_created()) { /* avoid munmap() on wrong pointer in tst_rmdir() */ tst_futexes = NULL; tst_rmdir(); } cleanup_ipc(); }
static void do_exit(void) { int ret = 0; printf("\nSummary:\n"); printf("passed %u\n", results->passed); printf("failed %u\n", results->failed); printf("skipped %u\n", results->skipped); printf("warnings %u\n", results->warnings); if (results->failed) ret |= TFAIL; if (results->skipped) ret |= TCONF; if (results->warnings) ret |= TWARN; cleanup_ipc(); exit(ret); }