library/src/blockclass/BP-BlockClass.cc
// creates a new thread and appends it to the threads list
creates a new thread and appends it to the threads list
creates a new thread and appends it to the threads list
int Block::CreateNewThread(void *( startRoutine)(void*), void *arg, int argLen, char * description)
{
	if(!startRoutine)
		return ERR_FAILURE;
	P_THREAD_LIST newThread = NULL;
	newThread = CreateThread(startRoutine, arg, argLen, description, &this->thread_info);
	if (newThread == NULL)
	{
		this->AddErrorToStack((char*) "Error in CreateNewThread: Failed to create thread.");
		return ERR_FAILURE;
	}
	if (threads != NULL)
		AppendThreadToList(threads, newThread);
	else
		threads = newThread;
	return ERR_SUCCESS;
}
int Block :: CreateNewThread ( void * ( startRoutine ) ( void * ) , void * arg , int argLen , char * description ) { if ( ! startRoutine ) return ERR_FAILURE ; P_THREAD_LIST newThread = NULL ; newThread = CreateThread ( startRoutine , arg , argLen , description , & this -> thread_info ) ; if ( newThread == NULL ) { this -> AddErrorToStack ( ( char * ) " " ) ; return ERR_FAILURE ; } if ( threads != NULL ) AppendThreadToList ( threads , newThread ) ; else threads = newThread ; return ERR_SUCCESS ; }
creates a new thread and appends it to the threads list
creates a new thread and appends it to the threads list
// create new thread list element // create the thread // check to see if the thread was created or not // add it to the list // return indicating success