Handbook
Glossary
sleep ( dt -- )
Factor handbook
»
The language
»
Co-operative threads
»
Yielding and suspending threads
Prev:
yield ( -- )
Next:
interrupt ( thread -- )
Vocabulary
threads
Inputs
dt
a duration
Outputs
None
Word description
Suspends the current thread for the given duration.
Other threads may interrupt the sleep by calling
interrupt
.
Examples
USING: threads calendar ; 10 seconds sleep
Definition
IN:
threads
GENERIC:
sleep
( dt -- )
Methods
USING:
calendar
threads
;
M:
duration
sleep
duration>nanoseconds
sleep
;
USING:
math
system
threads
;
M:
real
sleep
>integer
nano-count
+
sleep-until
;