F$Sleep

From NitrOS-9
Jump to: navigation, search
Sleep Temporarily turns off the calling process
OS9 F$Sleep 103F 0A

Entry Conditions

X One of the following:

sleep time (in ticks)

0 = sleep indefinitely

1 = sleep for the remainder of the current time slice

Exit Conditions

X sleep time minus the number of ticks that the process was asleep

Error Output

CC carry set on error

B error code (if any)

Additional Information

  • If Register X contains zero, NitrOS-9 turns the process off until it receives a signal. Putting a process to sleep is a good way to wait for a signal or interrupt without wasting CPU time.
  • If Register X contains one, NitrOS-9 turns the process off for the remainder of the process’s current time slice. It inserts the process into the active process queue immediately. The process resumes execution when it reaches the front of the queue.
  • If Register X contains an integer in the rage 2-255, NitrOS-9 turns off the process for the specified number of ticks, n. It inserts the process into the active process queue after n-1 ticks. The process resumes execution when it reaches the front of the queue. If the process receives a signal, it awakens before the time has elapsed.
  • When you select processes among multiple windows, you might need to sleep for two ticks.

krnp2