library/src/events/BP-Events.cc
// Pickup the highest priority event from main loop.
Pickup the highest priority event from main loop.
Pickup the highest priority event from main loop .
P_BP_EVENT BP_EventMgrPickupHighestPriorityEventFromMainLoop
(
		P_BP_EVENT_MANAGER      mgr,
		BP_EVENT_MESSAGE_IN_OUT pickup_from_queue
)
{
	if(!mgr)
		return NULL;
	if(!pickup_from_queue)
		return NULL;
	P_BP_EVENT event = NULL;
	BP_GHT_ENTER_CRITICAL_SECTION;
	event = BP_EventMgrPickupEventFromMainLoop
	(
			mgr,
			pickup_from_queue,
			BP_EVENT_PRIORITY_CRITICAL_SYSTEM
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromMainLoop
	(
			mgr,
			pickup_from_queue,
			BP_EVENT_PRIORITY_SYSTEM
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromMainLoop
	(
			mgr,
			pickup_from_queue,
			BP_EVENT_PRIORITY_HIGH
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromMainLoop
	(
			mgr,
			pickup_from_queue,
			BP_EVENT_PRIORITY_MID_HIGH
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromMainLoop
	(
			mgr,
			pickup_from_queue,
			BP_EVENT_PRIORITY_NORMAL
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromMainLoop
	(
			mgr,
			pickup_from_queue,
			BP_EVENT_PRIORITY_MID_NORMAL
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromMainLoop
	(
			mgr,
			pickup_from_queue,
			BP_EVENT_PRIORITY_LOW
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromMainLoop
	(
			mgr,
			pickup_from_queue,
			BP_EVENT_PRIORITY_VERY_LOW
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	BP_GHT_LEAVE_CRITICAL_SECTION;
	return NULL;
}
P_BP_EVENT BP_EventMgrPickupHighestPriorityEventFromMainLoop ( P_BP_EVENT_MANAGER mgr , BP_EVENT_MESSAGE_IN_OUT pickup_from_queue ) { if ( ! mgr ) return NULL ; if ( ! pickup_from_queue ) return NULL ; P_BP_EVENT event = NULL ; BP_GHT_ENTER_CRITICAL_SECTION ; event = BP_EventMgrPickupEventFromMainLoop ( mgr , pickup_from_queue , BP_EVENT_PRIORITY_CRITICAL_SYSTEM ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromMainLoop ( mgr , pickup_from_queue , BP_EVENT_PRIORITY_SYSTEM ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromMainLoop ( mgr , pickup_from_queue , BP_EVENT_PRIORITY_HIGH ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromMainLoop ( mgr , pickup_from_queue , BP_EVENT_PRIORITY_MID_HIGH ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromMainLoop ( mgr , pickup_from_queue , BP_EVENT_PRIORITY_NORMAL ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromMainLoop ( mgr , pickup_from_queue , BP_EVENT_PRIORITY_MID_NORMAL ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromMainLoop ( mgr , pickup_from_queue , BP_EVENT_PRIORITY_LOW ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromMainLoop ( mgr , pickup_from_queue , BP_EVENT_PRIORITY_VERY_LOW ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; BP_GHT_LEAVE_CRITICAL_SECTION ; return NULL ; }
Pickup the highest priority event from main loop.
Pickup the highest priority event from main loop .
// ensure we have a worker and a pickup queue designated // set event // enter critical section // --- Critical System ------------------ // attempt to pick up a critical system event (highest level of event) // return the event if it was looked up ok // --- System // attempt to pick up a system event // return the event if it was looked up ok // --- High // attempt to pick up event // return the event if it was looked up ok // --- Mid High // attempt to pick up event // return the event if it was looked up ok // --- Normal // attempt to pick up event // return the event if it was looked up ok // --- Mid Normal // attempt to pick up event // return the event if it was looked up ok // --- Low // attempt to pick up event // return the event if it was looked up ok // --- Very Low // attempt to pick up event // return the event if it was looked up ok // exit critical section // return null if no events can be found