int init(){
#if STATIC_WORKQUEUE
    pthread_workqueue_init_np();
#endif
#if STATIC_KQUEUE
    libkqueue_init();
#endif
    libdispatch_init();

    return 0;
}
示例#2
0
BOOL WINAPI DllMain(
    HINSTANCE hinstDLL,  // handle to DLL module
    DWORD fdwReason,     // reason for calling function
    LPVOID lpReserved )  // reserved
{
    // Perform actions based on the reason for calling.
    switch( fdwReason ) 
    { 
        case DLL_PROCESS_ATTACH:
		 // Initialize once for each new process.
         // Return FALSE to fail DLL load.
			if( pthread_workqueue_init_np() < 0)
				return FALSE;
            break;

    }
    return TRUE;  // Successful DLL_PROCESS_ATTACH.
}
示例#3
0
文件: test.c 项目: chsu-ibm/libpwq
int main() {
    pthread_workqueue_t wq;
    int rv;

	pthread_workqueue_init_np();

#ifdef __linux__
    //FIXME: This is now a hidden symbol 
    //printf("runqueue length=%d\n", linux_get_runqueue_length());
#endif

    sem_init(&test_complete, 0, 0);

    run_overcommit_test(NULL);

    printf("pthread_workqueue_create_np().. ");
    rv = pthread_workqueue_create_np(&wq, NULL);
    if (rv != 0)
        err(1, "failed");
    printf("ok\n");

    run_suspend_test();

    printf("stress test.. ");
    run_stress_test(wq, 25);
    printf("ok\n");

    run_fork_test(wq);

    //run_deadlock_test();
//    run_cond_wait_test();
//    run_blocking_test();
    //run_load_test();


	puts("All tests completed.\n");
    exit(0);
}