MainWindow::~MainWindow() { destroy_log(); delete ui; delete gw; delete program_help_dialog; }
void presenter_test() { init_log(); test_display_empty_board(); reset_log(); success(); test_display_played_board(); reset_log(); success(); test_display_turn(); reset_log(); success(); test_display_invalid_move(); reset_log(); success(); test_show_winner(); reset_log(); success(); test_show_draw(); reset_log(); success(); test_get_move(); success(); destroy_log(); }
void close_log_system() { COMPARE_AND_SWAP(&(g_log_system->is_close),0,1); //停止写日志线程,并等待结束 //g_log_system->is_close = 1; thread_join(g_log_system->worker_thread); mutex_lock(g_log_system->mtx); while(!link_list_is_empty(g_log_system->log_files)) { log_t l = LINK_LIST_POP(log_t,g_log_system->log_files); destroy_log(&l); } mutex_unlock(g_log_system->mtx); mutex_destroy(&g_log_system->mtx); destroy_link_list(&g_log_system->log_files); destroy_thread(&g_log_system->worker_thread); //DESTROY(&(g_log_system->_wpacket_allocator)); free(g_log_system); g_log_system = 0; }
void game_test() { init_log(); test_handles_draw(); reset_log(); success(); test_handles_win(); reset_log(); success(); test_gets_valid_move(); reset_log(); success(); test_switches_turns(); reset_log(); success(); destroy_log(); }
void destroy_db(const char *dir) { destroy_log(path(dir, "log")); destroy_mtree(path(dir, "mtree")); ermdir(dir); }
void * logs (void * v) { Log * lg = NULL ; Param_log * p = (Param_log *) v ; FILE * f_g = PARAM_LOG_FG(p) ; FILE * f_c = PARAM_LOG_FC(p) ; FILE * f_s = PARAM_LOG_FS(p) ; if (f_g == NULL) f_g = stdout ; if (f_c == NULL) f_c = stdout ; if (f_s == NULL) f_s = stdout ; int * res = malloc (sizeof(int)) ; *res = -1 ; while (1) { lg = NULL ; sem_wait (&(sem_log)) ; sem_wait(&LISTE_SEMAPHORE(file_logs)); liste_rm(file_logs , NULL , (void **)&lg); sem_post(&LISTE_SEMAPHORE(file_logs)); if (lg != NULL) { t = ctime(&LOG_TIME(lg)) ; t[TIME_BUF_SIZE-2] = '\0' ; fprintf(f_g , "log general %s: %d %s\n" , t , LOG_ID(lg) , LOG_MESG(lg)); switch(LOG_TYPE(lg)) { case LOG_CONNEXION : fprintf(f_c , "log connexion %s: %d %s\n" , t , LOG_ID(lg) , LOG_MESG(lg)); break ; case LOG_STAT : fprintf(f_s , "log stat %s: %d %s\n" , t , LOG_ID(lg) , LOG_MESG(lg)); break ; case LOG_GENERAL : break ; case LOG_DECONNEXION : fclose(f_g); fclose(f_c); fclose(f_s); goto end ; } destroy_log((void *) lg); } } end : *res = 0 ; free(p); pthread_exit(res) ; }