library/src/threads/BP-LinuxThreads.cc
// Create a new thread manager.
Create a new thread manager.
Create a new thread manager .
P_BP_THREAD_MANAGER BP_CreateThreadManager(char *name, char *description)
{
	if(!name || !description)
		return NULL;
	P_BP_LINKL manager_tq = BP_CreateLinkL("thread_manager_linkl", BP_TRUE);
	if(!manager_tq)
		return NULL;
	P_BP_THREAD_MANAGER thread_manager = (P_BP_THREAD_MANAGER) tq_calloc(manager_tq, sizeof(BP_THREAD_MANAGER), 1, BPLN);
	thread_manager->system_hreg = BP_CreateHashTableRegistry();
	sem_init(&thread_manager->lock, 1, 1);
	thread_manager->tq = manager_tq;
	thread_manager->name = tq_strdup(thread_manager->tq, name, BPLN);
	thread_manager->description = tq_strdup(thread_manager->tq, description, BPLN);
	thread_manager->status = BP_THREAD_MANAGER_STATUS_IDLE;
	return thread_manager;
}
P_BP_THREAD_MANAGER BP_CreateThreadManager ( char * name , char * description ) { if ( ! name || ! description ) return NULL ; P_BP_LINKL manager_tq = BP_CreateLinkL ( " " , BP_TRUE ) ; if ( ! manager_tq ) return NULL ; P_BP_THREAD_MANAGER thread_manager = ( P_BP_THREAD_MANAGER ) tq_calloc ( manager_tq , sizeof ( BP_THREAD_MANAGER ) , 1 , BPLN ) ; thread_manager -> system_hreg = BP_CreateHashTableRegistry ( ) ; sem_init ( & thread_manager -> lock , 1 , 1 ) ; thread_manager -> tq = manager_tq ; thread_manager -> name = tq_strdup ( thread_manager -> tq , name , BPLN ) ; thread_manager -> description = tq_strdup ( thread_manager -> tq , description , BPLN ) ; thread_manager -> status = BP_THREAD_MANAGER_STATUS_IDLE ; return thread_manager ; }
Create a new thread manager.
Create a new thread manager .
// ensure we have a name and description // create manager // create system registry for enabling critical sections (hash table feature) // initialize the managment semaphore // set new manager tailqueue // dupliate the name // duplicate the description // after the manager is created, set the status to idl // return the new manager