library/src/threads/BP-LinuxThreads.cc
// this version of the above function checks/marks the status of all of the threads.  If ANY thread
// is running, this function returns ERR_SUCCESS.  This function returns ERR_FAILURE if some threads
// are still running.  Check the lists->threadState variable to see which threads are exited etc.  This
// function does modify the elements status variable.
this version of the above function checks/marks the status of all of the threads.  If ANY thread
is running, this function returns ERR_SUCCESS.  This function returns ERR_FAILURE if some threads
are still running.  Check the lists->threadState variable to see which threads are exited etc.  This
function does modify the elements status variable.
this version of the above function checks / marks the status of all of the threads . If ANY thread is running this function returns ERR_SUCCESS . This function returns ERR_FAILURE if some threads are still running . Check the lists - > threadState variable to see which threads are exited etc . This function does modify the elements status variable .
BP_ERROR_T CheckAllThreadsAndUpdateStatus(P_THREAD_LIST threads)
{
	if(!threads)
	{
		printf("\n [!!] Unable to check status of NULL threads list.");
		return ERR_FAILURE;
	}
	size_t thread_is_running = 0;
	for(threads = threads->first; threads; threads = threads->next)
	{
		if(!threads)
		{
			printf("\n [!!] a thread element of NULL value has been detected.  Bad loop logic, possible corruption.");
			return ERR_FAILURE;
		}
		if(CheckThreadStatusCode(threads) == BP_THREAD_STATUS_RUNNING)
			thread_is_running = 1;
	}
	if(thread_is_running)
		return ERR_SUCCESS;
	return ERR_FAILURE;
}
BP_ERROR_T CheckAllThreadsAndUpdateStatus ( P_THREAD_LIST threads ) { if ( ! threads ) { printf ( " \n " ) ; return ERR_FAILURE ; } size_t thread_is_running = 0 ; for ( threads = threads -> first ; threads ; threads = threads -> next ) { if ( ! threads ) { printf ( " \n " ) ; return ERR_FAILURE ; } if ( CheckThreadStatusCode ( threads ) == BP_THREAD_STATUS_RUNNING ) thread_is_running = 1 ; } if ( thread_is_running ) return ERR_SUCCESS ; return ERR_FAILURE ; }
this version of the above function checks/marks the status of all of the threads.
this version of the above function checks / marks the status of all of the threads .
// check to see if we have a pointer to a list // this is a flag which is incremented in the case that a thread has been discovered as running // iterate through the threads // check for null (corruption marker) // if the thread is running, mark it // return indicating success // if no threads are running, return indicating failure