library/src/blockclass/BP-BlockClass.cc
// Gets the actual thread ptr by description.
Gets the actual thread ptr by description.
Gets the actual thread ptr by description .
P_THREAD_LIST Block::GetThreadPtrByDescription(char *desc, int cmpLen)
{
	if (this->threads == NULL)
	{
		this->AddErrorToStack((char*) "Error in GetThreadPtrByDescription: No threads to poll from.");
		return NULL;
	}
	P_THREAD_LIST threadFirst = this->threads->first;
	int i = 0;
	for (; threadFirst != NULL; threadFirst = threadFirst->next)
	{
		if (threadFirst->threadDescription)
		if (memcmp(threadFirst->threadDescription, desc, cmpLen) == 0)
		{
			return threadFirst;
		}
	}
	return NULL;
}
P_THREAD_LIST Block :: GetThreadPtrByDescription ( char * desc , int cmpLen ) { if ( this -> threads == NULL ) { this -> AddErrorToStack ( ( char * ) " " ) ; return NULL ; } P_THREAD_LIST threadFirst = this -> threads -> first ; int i = 0 ; for ( ; threadFirst != NULL ; threadFirst = threadFirst -> next ) { if ( threadFirst -> threadDescription ) if ( memcmp ( threadFirst -> threadDescription , desc , cmpLen ) == 0 ) { return threadFirst ; } } return NULL ; }
Gets the actual thread ptr by description.
Gets the actual thread ptr by description .
//ensure we have threads // set thread pointer // walk threads and find correct thread // ensure there is a description set on the thread // return the thread number // return null for failure in the case that the thread cannot be located