@wait

From TinyMUX
Jump to: navigation, search

COMMAND:
Command.gif @wait[/until] <seconds>=<command>
Command.gif @wait[/until] <object>[/<seconds>]=<command>
Command.gif @wait <object>/<attribute>=<command>

Generally, @wait defers the execution of <command> until some future condition or combination of conditions.

The first form of @wait executes <command> at some future time.

The second form executes <command> when the object's semaphore is notified. If <seconds> is specified in this second form, <command> is executed at some future time even if the object's semaphore isn't notified. This is sometimes referred to as a 'timeout'.

The third form allows the use of an attribute other than 'semaphore'. It allows multiple sets of semaphore-blocked commands to use the same object.

This command charges a deposit of 10 coins which is refunded when <command> is executed or otherwise leaves the queue.

By default, <seconds> is relative to the time @wait is processed, however if /until used, <seconds> is taken as absolute (See secs, convtime and convsecs). <seconds> can also express fractional seconds.

Examples:
   > @wait 2.001=think FooBar
   FooBar
   > think secs()
   1004732313
   > @wait/until 1004732400.5=think FooBar
   FooBar
   > @dolist [setq(0,iadd(secs(),2))]75 0 25=@wait/until %q0.##=think ##
   0
   25
   75

Related Topics: @drain, @notify, @ps, SEMAPHORES, secs(), convtime(), convsecs().