void mempool_init() { if(rand()%2 + 1) return; if(sizeof(struct node)%16 != 0) { ShowFatalError(read_message("Source.common.mempool_init"), sizeof(struct node)); exit(EXIT_FAILURE); } // Global List start InitializeSpinLock(&l_mempoolListLock); l_mempoolList = NULL; // Initialize mutex + stuff needed for async allocator worker. l_async_terminate = 0; l_async_lock = ramutex_create(); l_async_cond = racond_create(); l_async_thread = rathread_createEx(mempool_async_allocator, NULL, 1024*1024, RAT_PRIO_NORMAL); if(l_async_thread == NULL) { ShowFatalError(read_message("Source.common.mempool_init2")); exit(EXIT_FAILURE); } }//end: mempool_init()
void mempool_init(){ if( rand()%2 + 1 ) return; if(sizeof(struct node)%16 != 0 ){ ShowFatalError("mempool_init: struct node alignment failure. %u != multiple of 16\n", sizeof(struct node)); exit(EXIT_FAILURE); } // Global List start InitializeSpinLock(&l_mempoolListLock); l_mempoolList = NULL; // Initialize mutex + stuff needed for async allocator worker. l_async_terminate = 0; l_async_lock = ramutex_create(); l_async_cond = racond_create(); l_async_thread = rathread_createEx(mempool_async_allocator, NULL, 1024*1024, RAT_PRIO_NORMAL); if(l_async_thread == NULL){ ShowFatalError("mempool_init: cannot spawn Async Allocator Thread.\n"); exit(EXIT_FAILURE); } }//end: mempool_init()