library/src/events/BP-Events.cc
// Pickup the lowest priority event from the current worker thread
Pickup the lowest priority event from the current worker thread
Pickup the lowest priority event from the current worker thread
P_BP_EVENT BP_EventMgrPickupLowestPriorityEventFromWorker
(
		P_BP_EVENT_WORKER worker,
		BP_EVENT_MESSAGE_IN_OUT pickup_from_queue
)
{
	if(!worker)
		return NULL;
	if(!pickup_from_queue)
		return NULL;
	P_BP_EVENT event = NULL;
	BP_GHT_ENTER_CRITICAL_SECTION;
	event = BP_EventMgrPickupEventFromWorker
	(
			worker,
			pickup_from_queue,
			BP_EVENT_PRIORITY_VERY_LOW
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromWorker
	(
			worker,
			pickup_from_queue,
			BP_EVENT_PRIORITY_LOW
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromWorker
	(
			worker,
			pickup_from_queue,
			BP_EVENT_PRIORITY_MID_NORMAL
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromWorker
	(
			worker,
			pickup_from_queue,
			BP_EVENT_PRIORITY_NORMAL
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromWorker
	(
			worker,
			pickup_from_queue,
			BP_EVENT_PRIORITY_MID_HIGH
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromWorker
	(
			worker,
			pickup_from_queue,
			BP_EVENT_PRIORITY_HIGH
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromWorker
	(
			worker,
			pickup_from_queue,
			BP_EVENT_PRIORITY_SYSTEM
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	event = BP_EventMgrPickupEventFromWorker
	(
			worker,
			pickup_from_queue,
			BP_EVENT_PRIORITY_CRITICAL_SYSTEM
	);
	if(event)
		BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(event);
	BP_GHT_LEAVE_CRITICAL_SECTION;
	return NULL;
}
P_BP_EVENT BP_EventMgrPickupLowestPriorityEventFromWorker ( P_BP_EVENT_WORKER worker , BP_EVENT_MESSAGE_IN_OUT pickup_from_queue ) { if ( ! worker ) return NULL ; if ( ! pickup_from_queue ) return NULL ; P_BP_EVENT event = NULL ; BP_GHT_ENTER_CRITICAL_SECTION ; event = BP_EventMgrPickupEventFromWorker ( worker , pickup_from_queue , BP_EVENT_PRIORITY_VERY_LOW ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromWorker ( worker , pickup_from_queue , BP_EVENT_PRIORITY_LOW ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromWorker ( worker , pickup_from_queue , BP_EVENT_PRIORITY_MID_NORMAL ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromWorker ( worker , pickup_from_queue , BP_EVENT_PRIORITY_NORMAL ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromWorker ( worker , pickup_from_queue , BP_EVENT_PRIORITY_MID_HIGH ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromWorker ( worker , pickup_from_queue , BP_EVENT_PRIORITY_HIGH ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromWorker ( worker , pickup_from_queue , BP_EVENT_PRIORITY_SYSTEM ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; event = BP_EventMgrPickupEventFromWorker ( worker , pickup_from_queue , BP_EVENT_PRIORITY_CRITICAL_SYSTEM ) ; if ( event ) BP_GHT_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( event ) ; BP_GHT_LEAVE_CRITICAL_SECTION ; return NULL ; }
Pickup the lowest priority event from the current worker thread
Pickup the lowest priority event from the current worker thread
// ensure we have a worker and a pickup queue designated // set event // enter critical section // --- Very Low // 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 // --- Mid Normal // 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 High // attempt to pick up 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 // --- System // attempt to pick up a system event // return the event if it was looked up ok // --- Critical System // attempt to pick up a system event // return the event if it was looked up ok // exit critical section // return null if no events can be found