library/src/threads/BP-LinuxThreads.cc
// DESIGNED TO BE CALLED FROM WITHIN THREAD: This function is used to set a status
// code to a thread list element safely within a threaded environment.  Call this before
// a thread has exited to notify the blockparty (or your own custom) thread manager of
// a thread exiting.
DESIGNED TO BE CALLED FROM WITHIN THREAD: This function is used to set a status
code to a thread list element safely within a threaded environment.  Call this before
a thread has exited to notify the blockparty (or your own custom) thread manager of
a thread exiting.
DESIGNED TO BE CALLED FROM WITHIN THREAD : This function is used to set a status code to a thread list element safely within a threaded environment . Call this before a thread has exited to notify the blockparty ( or your own custom ) thread manager of a thread exiting .
BP_ERROR_T SetThreadStatusCode(P_THREAD_LIST thread_elem, BP_THREAD_STATUS status_code)
{
	if(!thread_elem)
		return ERR_FAILURE;
	while(LockMutex((pthread_mutex_t *) &thread_elem->thread_lock) != ERR_SUCCESS){};
	thread_elem->threadState = status_code;
	while(UnlockMutex((pthread_mutex_t *) &thread_elem->thread_lock) != ERR_SUCCESS){};
	return ERR_SUCCESS;
}
BP_ERROR_T SetThreadStatusCode ( P_THREAD_LIST thread_elem , BP_THREAD_STATUS status_code ) { if ( ! thread_elem ) return ERR_FAILURE ; while ( LockMutex ( ( pthread_mutex_t * ) & thread_elem -> thread_lock ) != ERR_SUCCESS ) { } ; thread_elem -> threadState = status_code ; while ( UnlockMutex ( ( pthread_mutex_t * ) & thread_elem -> thread_lock ) != ERR_SUCCESS ) { } ; return ERR_SUCCESS ; }
DESIGNED TO BE CALLED FROM WITHIN THREAD: This function is used to set a status
code to a thread list element safely within a threaded environment.
DESIGNED TO BE CALLED FROM WITHIN THREAD : This function is used to set a status code to a thread list element safely within a threaded environment .
// ensure that the thread element is non-null // try to lock the mutex // data is now locked, set status appropriately. // unlock the mutex // return indicating success