library/src/semaphores/BP-Semaphores.cc
// Attempts to retrieve a keyed table entry (hash table entry) for the
// provided semaphore.
Attempts to retrieve a keyed table entry (hash table entry) for the
provided semaphore.
Attempts to retrieve a keyed table entry ( hash table entry ) for the provided semaphore .
P_BP_HASH_TABLE_KEYED_ENTRY BP_SemaphoreGetKeyedTableEntry(P_BP_SEMAPHORE_INFO sem)
{
	BP_SEMAPHORE_VALIDATE_WORKING_ENVIRONMENT(NULL);
	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] = (char *)&sem->uuid_key;
	table_path[3] = NULL;
	tmp_lookup = BP_HashRegLookupTableByPath(NULL, table_path);
	if(tmp_lookup)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(tmp_lookup);
	BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(NULL);
}
P_BP_HASH_TABLE_KEYED_ENTRY BP_SemaphoreGetKeyedTableEntry ( P_BP_SEMAPHORE_INFO sem ) { BP_SEMAPHORE_VALIDATE_WORKING_ENVIRONMENT ( NULL ) ; 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 ] = ( char * ) & sem -> uuid_key ; table_path [ 3 ] = NULL ; tmp_lookup = BP_HashRegLookupTableByPath ( NULL , table_path ) ; if ( tmp_lookup ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( tmp_lookup ) ; BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( NULL ) ; }
Attempts to retrieve a keyed table entry (hash table entry) for the
provided semaphore.
Attempts to retrieve a keyed table entry ( hash table entry ) for the provided semaphore .
// validate that there is a working environment // ensure we have a semaphore info structure // ensure the uuid has been set // enter critical section // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% First Check for Semaphore %%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // 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 // return NULL on failure to lookup