al_get_cpu_count(3)
al_get_cpu_count(3) π»β¨
okay so bestie, welcome to the Library Functions Manual page for al_get_cpu_count, straight out of the Allegro 5 API π
this one is short but it's giving βhow many CPU cores even are there?β energy, and we're gonna read it together.
πΈ NAME πΈ
al_get_cpu_count β Allegro 5 API. That's it, that's the name, iconic.
β¨ SYNOPSIS β¨
#include <allegro5/allegro.h>
int al_get_cpu_count(void)
π DESCRIPTION π
So this function returns the number of CPU cores that the system Allegro is running on has and which could be detected β or a negative number if detection failed π. Yes, negative. It can just fail like that.
Even if a positive number comes back, lowkey it might not be correct. For example, Allegro running on a virtual machine will return the amount of CPUβs of the VM, and not that of the underlying system. So the number is giving βwhat the VM sees,β not βwhat the whole physical situation is,β iykyk.
And fr fr, even if the number is correct, this only gives you information about the total CPU cores of the system Allegro runs on. The amount of cores available to your program may be less due to circumstances such as programs that are currently running π. Other stuff is out here using CPU too, bestie.
Therefore, it's best to use this for advisory purposes only. It is certainly a bad idea to make your program exclusive to systems for which this function returns a certain βdesirableβ number. Periodt. Don't gatekeep your program on a CPU count vibe check.
This function may be called prior to al_install_system(3) or al_init(3). Slay, no setup required.
β SINCE β
5.1.12 β yes bestie, it's been around since then.
byeee π«Ά source/version check: Allegro reference manual; date check: no date listed in this footer, so no cap on the timestamp. al_get_cpu_count(3) out. πβ¨
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms