Did you know ... Search Documentation:
Predicate pengine_event/1
 pengine_event(?EventTerm) is det[private]
 pengine_event(?EventTerm, +Options) is det[private]
Examines the pengine's event queue and if necessary blocks execution until a term that unifies to Term arrives in the queue. After a term from the queue has been unified to Term, the term is deleted from the queue.

Valid options are:

Time is a float or integer and specifies the maximum time to wait in seconds. If no event has arrived before the time is up EventTerm is bound to the atom timeout.
Only listen to events from the pengine identified by Id.