rest(3)
π€ rest(3) β the Allegro manual, but make it cozy
okay bestie, pull up a chair, we're talking about rest from the Allegro game programming library. she's tiny, she's iconic, she's literally just a nap for your CPU. π
β¨ NAME β¨
rest β waits a specified number of milliseconds or yields CPU. part of the Allegro game programming library, no cap. π¦
πΈ SYNOPSIS πΈ
#include <allegro.h>
void rest(unsigned int time);
π DESCRIPTION π
so this function does exactly what it says on the tin: it waits for the number of milliseconds you hand it. that's it. that's the whole vibe. β³
but here's the tea π β passing 0 as the parameter will not wait. it just yields. and like, that's actually lowkey useful, because it's how you "play nice" with other processes. sharing is caring, bestie. π«Ά
any other value? that causes CPU time to be dropped on most platforms. which is highkey a glow-up for everyone involved: it looks better to users, and it also does things like saving battery power and making fans less noisy. your laptop's fan is not your enemy, she's just stressed. give her a break. π₯π
β οΈ the one thing you gotta know: calling this inside your active game loop is a bad idea. like, genuinely. because you never know when the OS will give you the CPU back, so you could end up missing the vertical retrace and skipping frames. and skipped frames? not the aesthetic we're going for. π
on the flip side though β on multitasking operating systems, it is good form to give up the CPU for a while if you will not be using it. queen behavior. let her breathe. π
π SEE ALSO π
and that's the whole page, bestie!! this was Allegro version 4.4.3 bringing you rest(3), and honestly? she ate. go take a nap (or yield, your choice). mwah πβ¨π
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms