UP
There are a small fixed number of "wait objects". A wait
object holds a value called "todw". A BWAIT key designates
a wait object.
See (p2,waitc) for a way to get
many keys to wait on.
BWAIT(0;==>c;) returns with c=0. It never returns much
later than when the real clock exceeds todw of the wait
object, and it seldom returns earlier. If there is already
a domain waiting on the designated wait object, the return
is immediate with c=1. {The waiting domain will not be paged
out.}
When the kernel is restarted, the todw of all wait objects
are set to 0. I think that this is the only time that the
order code 0 returns sooner than the indicated todw value.
BWAIT(1,tod;==>;) causes todw of the designated
wait object to be set to tod. Tod is 64 bits long.
Programing notes:
BWAIT may be used to create a multiplexed timer facility.
The earliest time of expiration in the queue is placed
in the BWAIT key by the queue handling domain while another
domain waits on the BWAIT key with order code zero. If
an earlier time of expiration arrives the first domain can
reset the time with BWAIT order code 1 without disturbing
the domain that is waiting on BWAIT order code zero.
A watchdog timer facility may be constructed to check that,
for example, some message arrives at least once every every
5 seconds. The watch dog waits on the BWAIT key and the
processing domain for the signal resets the BWAIT key time
to now + 5 seconds whenever a message is processed.
Design Note:
Since the kernel itself has need for bwait-like functions
{migration, timeouts, etc} we found that it was as easy
to provide several wait objects as just one. Heavy duty
or primordial domains that are trusted not to lose their
BWAIT key can thus have their own wait objects.