rest(3alleg4)
π€ rest β the "bestie please chill" function
okay so, we're in the Allegro game programming library, manual section 3, and today's main character is rest. she's the one who tells your program to take a lil nap. β¨
πΈ SYNOPSIS
#include <allegro.h>
void rest(unsigned int time);
π¦ DESCRIPTION
So rest waits for however many milliseconds you hand it in time. That's it. That's the whole vibe. She waits, you vibe. π
Now here's the tea π« β if you pass 0 as the parameter, she does not wait at all, she just yields. And lowkey that's so useful?? It's literally how you "play nice" with other processes on the system. Sharing is caring, bestie. π«Ά
Any other value will cause CPU time to be dropped on most platforms. And that's a good thing, fr fr β it looks better to users, plus it does cute little side quests like saving battery power and making fans less noisy. π Your laptop's fan will literally thank you.
β οΈ BUT. Big but. Calling this inside your active game loop is a bad idea. Like, genuinely. The way that you never know when the OS will give you the CPU back π β so you could end up missing the vertical retrace and skipping frames. That's giving dropped frames energy and nobody wants that. π
β¨ On the flip side tho β on multitasking operating systems, it is good form to give up the CPU for a while if you will not be using it. So. Read the room. iykyk. π
π SEE ALSO
Allegro version 4.4.3 π β and that's the whole page, rest(3alleg4), periodt. go take a nap, you earned it. π
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms