library/src/semaphores/BP-Semaphores.cc
// Attempts to retrieve a semaphore lock keyed table entry (hash table entry) for the
// provided semaphore.  This returns the first semaphore only, and is used primarily
// by BP_SemaphorePost_real.
Attempts to retrieve a semaphore lock keyed table entry (hash table entry) for the
provided semaphore.  This returns the first semaphore only, and is used primarily
by BP_SemaphorePost_real.
Attempts to retrieve a semaphore lock keyed table entry ( hash table entry ) for the provided semaphore . This returns the first semaphore only and is used primarily by BP_SemaphorePost_real .
P_BP_HASH_TABLE_KEYED_ENTRY BP_SemaphoreLocksGetFirstLock(P_BP_SEMAPHORE_INFO sem)
{
	if(!sem)
		return NULL;
	if(!strnlen(sem->uuid_key, 1))
		return NULL;
	BP_GHT_ENTER_CRITICAL_SECTION;
	P_BP_HASH_TABLE_KEYED_ENTRY tmp_lookup = NULL;
	char *table_path[10];
	BP_ZERO_STACK(table_path);
	table_path[0] = "system";
	table_path[1] = "semaphores";
	table_path[2] = sem->uuid_key;
	table_path[3] = "locks";
	table_path[4] = NULL;
	tmp_lookup = BP_HashRegLookupTableByPath(NULL, table_path);
	if(!tmp_lookup)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(NULL);
	tmp_lookup = (P_BP_HASH_TABLE_KEYED_ENTRY) tmp_lookup->data;
	if(!tmp_lookup)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(NULL);
	P_BP_HASH_TABLE_KEYED_ENTRY entry       = NULL;
	P_BP_HASH_TABLE_KEYED_ENTRY tmp         = NULL;
	HASH_ITER(hh, tmp_lookup, entry, tmp)
	{
		break;
	}
	BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(entry);
}
P_BP_HASH_TABLE_KEYED_ENTRY BP_SemaphoreLocksGetFirstLock ( P_BP_SEMAPHORE_INFO sem ) { if ( ! sem ) return NULL ; if ( ! strnlen ( sem -> uuid_key , 1 ) ) return NULL ; BP_GHT_ENTER_CRITICAL_SECTION ; P_BP_HASH_TABLE_KEYED_ENTRY tmp_lookup = NULL ; char * table_path [ 10 ] ; BP_ZERO_STACK ( table_path ) ; table_path [ 0 ] = " " ; table_path [ 1 ] = " " ; table_path [ 2 ] = sem -> uuid_key ; table_path [ 3 ] = " " ; table_path [ 4 ] = NULL ; tmp_lookup = BP_HashRegLookupTableByPath ( NULL , table_path ) ; if ( ! tmp_lookup ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( NULL ) ; tmp_lookup = ( P_BP_HASH_TABLE_KEYED_ENTRY ) tmp_lookup -> data ; if ( ! tmp_lookup ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( NULL ) ; P_BP_HASH_TABLE_KEYED_ENTRY entry = NULL ; P_BP_HASH_TABLE_KEYED_ENTRY tmp = NULL ; HASH_ITER ( hh , tmp_lookup , entry , tmp ) { break ; } BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( entry ) ; }
Attempts to retrieve a semaphore lock keyed table entry (hash table entry) for the
provided semaphore.
Attempts to retrieve a semaphore lock keyed table entry ( hash table entry ) for the provided semaphore .
// ensure we have a semaphore info structure // ensure the uuid has been set // enter critical section // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Attempt Table Lookup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // declare the lookup pointer // create table path and zero it // now check for the semaphore path // check for tmp_lookup, continue loop if it doesn't exist // advance the tmp lookup pointer to the data position // so we can run our lookup in the iter loop below. // temporary iterator values used during the HASH_ITER loop below // iterate through all hashes and display // break on first iter (aka first record) // return the lookup