int test_osl_wait(void) { int i; init_waitqueue_head(&wq); for (i=0; i<MAX_TASK_COUNT; i++) { tasks[i] = kthread_run(task_main, i, "test_osl_wait"); } taskDelay(10); for (i=MAX_TASK_COUNT-1; i>=0; i--) { state = i; printf("wake_up: %d\n", i); wake_up(&wq); taskDelay(10); } taskDelay(10); printf("try delete\n"); sema_delete(wq); return 0; }
int fini_zlog() { gs_zlog.is_to_exit = TRUE; sema_v(gs_zlog.sema); thread_stop(gs_zlog.thread); sema_delete(gs_zlog.sema); mutex_delete(gs_zlog.mutex); if (gs_zlog.file_prefix != NULL) free(gs_zlog.file_prefix); if (gs_zlog.file != NULL) fclose(gs_zlog.file); return S_OK; }