library/src/events/BP-Events.cc
// add event to the poll hash table so it can be processed by the main loop
add event to the poll hash table so it can be processed by the main loop
add event to the poll hash table so it can be processed by the main loop
BP_ERROR_T BP_EventManagerEventsPolledAddEvent
(
	P_BP_EVENT_MANAGER mgr,
	P_BP_EVENT         event
)
{
	if(!mgr)
		return ERR_FAILURE;
	if(!event)
		return ERR_FAILURE;
	if(!mgr->events_polled_for_main_loop)
		return ERR_FAILURE;
	BP_HASH_TABLE_ENTER_CRITICAL_SECTION(mgr->events_polled_for_main_loop);
	char *table_path[10];
	BP_ZERO_STACK(table_path);
	table_path[0] = "events";
	printf("\n DBGCHECK Got Event Name here: %s", event->name);
	BP_HashRegAddDataToTableByPath
	(
		mgr->events_polled_for_main_loop,
		(char **) &table_path,
		event->name,
		BP_HASH_TABLE_KEYED_ENTRY_TYPE_BINARY_BLOB,
		event,
		sizeof(BP_EVENT)
	);
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(mgr->events_polled_for_main_loop, ERR_SUCCESS)
}
BP_ERROR_T BP_EventManagerEventsPolledAddEvent ( P_BP_EVENT_MANAGER mgr , P_BP_EVENT event ) { if ( ! mgr ) return ERR_FAILURE ; if ( ! event ) return ERR_FAILURE ; if ( ! mgr -> events_polled_for_main_loop ) return ERR_FAILURE ; BP_HASH_TABLE_ENTER_CRITICAL_SECTION ( mgr -> events_polled_for_main_loop ) ; char * table_path [ 10 ] ; BP_ZERO_STACK ( table_path ) ; table_path [ 0 ] = " " ; printf ( " \n " , event -> name ) ; BP_HashRegAddDataToTableByPath ( mgr -> events_polled_for_main_loop , ( char * * ) & table_path , event -> name , BP_HASH_TABLE_KEYED_ENTRY_TYPE_BINARY_BLOB , event , sizeof ( BP_EVENT ) ) ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( mgr -> events_polled_for_main_loop , ERR_SUCCESS ) }
add event to the poll hash table so it can be processed by the main loop
add event to the poll hash table so it can be processed by the main loop
// ensure we have a manager and an event // ensure the events polling table has been created (should be created on init) // enter critical section // create arbtrary table path and zero it // set initial path to zero // attempt to add data to the table // leave critical section and return indicating success