Programming
The Programming toolbox has one node today: Sleep. It pauses the program that is running for at least the number of milliseconds you give it.
Use it in a Routine graph when you need a pause: between two actions that another program has to keep up with, between web requests to a service that limits how often you call it, or to slow a loop down so you can watch it.
- Included in: Divooka Explore and Divooka Compute, every tier. Every document has it, even one made from the Blank workload.
- Maturity: Usable · Support: Tier 1 (proposed) · what these mean
- Open it: node library (
Ctrl+Shift+Space) → Programming, or search for a node withCtrl+Space. - Reference: Programming node reference
New to graphs? Start with Your first program.
Example: wait one second between two lines
In a Routine graph, connect three steps through their Next and Previous pins:
- Print Line, Message
Start. - Sleep, Milliseconds Timeout
1000. - Print Line, Message
One second later.
Run it with F5. The second line appears about a second after the first.
Tips and limits
- The pause is a minimum. The real pause is usually a little longer than asked, by up to the operating system's timer resolution.
0gives up the rest of the current time slice;-1pauses forever. - The graph waits. The step after Sleep starts only when the pause ends. In a Routine, Wait For in Basic waits a number of seconds and can be ended early with Stop.
- Not for games. For timed work in a game or animation, use the frame time of Application Framework's realtime application.
- Not the same as the Programming category. The Basic toolbox also has a category called Programming, with Capture and Apply Function for functions passed as values.
What is in the toolbox
| Category | Some of its nodes |
|---|---|
| Thread Routines | Sleep |
See also
- Programming node reference
- Basic - loops, branches and Wait For.
- Toolboxes - every other toolbox.