[fpc-pascal] number of cpu cores

Michalis Kamburelis michalis.kambi at gmail.com
Sat Nov 29 18:56:29 CET 2008

Florian Klaempfl wrote:
> Mattias Gaertner schrieb:
>> I need a default value of the number of maximum threads.
>> Is there already some RTL function that can be used for that?
>> For example if the program runs on a 2 x quad core it would be nice to
>> get 8.
>> Hyperthreading multipliers should be applied.
> No, but having some functions returning information about the CPUs would
> be nice.

Blender (http://www.blender.org/) source code has function to do that
(they needed this to set the default number of threads for renderer). So
you could try converting to Pascal the code of "BLI_system_thread_count"
function from:


Doesn't seem that complicated on 1st look. It's basically appropriate
GetSystemInfo call on Windows, sysctl on Mac OS, and sysconf (from Libc)
call on most Unixes.


More information about the fpc-pascal mailing list