On 2/28/2011 7:22 AM, Don wrote:
Russel Winder wrote:
I accept your argument about core.cpuid and so will not investigate it
further, other than to say it needs to work on 64-bit processors as well
as 32-bit ones. The campaign now must be to have an OS query capability
to find the number of processors.
Yes, it definitely needs to be a priority. It's a fundamental function
for a modern system programming language.
I'm not sure where this stuff should go, probably not into core.cpuid.
I could imagine something with a name like std.sysinfo, which dealt with
system configuration, and also provided OS-independent abstractions for
things like setting process affinity.
I think it should go into std.parallelism for now.
Done. This was actually much easier than I thought. I didn't
document/expose it, though, because I didn't put any thought into
creating an API for it. I just implemented the bare minimum to make
std.parallelism work properly.
https://github.com/dsimcha/std.parallelism/commit/db7751ba436af3f7ffcaa1b65070f3981a75f98a
This code is tested (at least on my hardware) on Windows 7 and Ubuntu
10.10 in both 32 and 64 mode. I did not test on Mac OS because I don't
own any such hardware, though it **should** work because Mac OS is also
POSIX. Someone please confirm.
BTW, I don't imagine we care about supporting ancient (pre-Windows 2000)
Windows. The Windows code will only work for Win2k and up.