Initializing help system before first use

waitfor

Purpose
Wait for specific events.
Synopsis
procedure waitfor(mask:integer)
procedure waitfor(mask:integer,dur:integer)
procedure waitfor(mask:integer,dur:integer,opt:integer)
procedure waitfor(mask:integer,id:integer,dur:integer,opt:integer)
Arguments
mask 
Bit mask of expected events
id 
ID of model for which events are expected
dur 
A duration in seconds, the constant WAIT_INFINITE or a timer identifier as a negative integer
opt 
Options:
WAIT_EXACT 
Mask must be exactly matched
WAIT_KEEP 
Keep unexpected events
WAIT_UID 
Wait for a particular user ID
WAIT_GID 
Wait for a particular group ID
Example
The following statement waits for an event of class 3 coming from a model of group 100 without dropping any event:
waitfor(3,100,WAIT_INFINITE,WAIT_KEEP+WAIT_EXACT+WAIT_GID) 
Further information
1. This procedure suspends the execution of the caller until an event of a particular class is available. The second form specifies a time limit: the processing is suspended for at most dur seconds, the special value WAIT_INFINITE is interpreted as an infinite duration.
2. If the time limit is 0 the execution is not suspended but the queue of events is processed once and a subsequent call to waitexpired will return true if no valid event was found.
3. The parameter dur may also take a negative value: in this case it is interpreted as the opposite of a timer identifier (see settimer) and the function will wait until this timer expires if no valid event arrives. When the routine interrupts its monitoring due to the expiration of a timer the first event in the queue is the event EVENT_TIMER associated to this timer. Note that if no timer corresponds to the given value the routine will terminate only when an expected event is available as if WAIT_INFINITE had been used.
4. By default, the parameter mask is interpreted as a bit mask to select the expected events: all events sent to the model are automatically dropped until an event ev satisfies the following condition:
bittest(getclass(ev),mask)<>0

5. If the parameter opt includes option WAIT_EXACT, the parameter mask becomes the target event class: the wait will end when an event of a class equal to mask is found.
6. If the parameter opt includes option WAIT_KEEP, unexpected events are not dropped but the first event satisfying the condition is moved to the top of the queue such that it is returned by the next call to getnextevent.
7. With the last form of the function an ID is specified: it characterises events coming from a particular model or a group of models. By default the argument id is interpreted as the unique model ID (see getid), if option WAIT_UID is used, the ID is interpreted as a user ID (see getuid) and with option WAIT_GID the argument is a group ID (see getgid).
Related topics
Module

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.