Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -607,8 +607,9 @@ #ifdef __cplusplus extern "C" { #endif extern size_t of_pagesize; +extern size_t of_num_cpus; #ifdef __cplusplus } #endif Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -89,10 +89,11 @@ static SEL cxx_construct = NULL; static SEL cxx_destruct = NULL; size_t of_pagesize; +size_t of_num_cpus; #ifdef NEED_OBJC_SYNC_INIT extern BOOL objc_sync_init(); #endif @@ -209,15 +210,19 @@ #if defined(_WIN32) SYSTEM_INFO si; GetSystemInfo(&si); of_pagesize = si.dwPageSize; + of_num_cpus = si.dwNumberOfProcessors; #elif defined(_PSP) of_pagesize = 4096; + of_num_cpus = 1; #else if ((of_pagesize = sysconf(_SC_PAGESIZE)) < 1) of_pagesize = 4096; + if ((of_num_cpus = sysconf(_SC_NPROCESSORS_CONF)) < 1) + of_num_cpus = 1; #endif } + (void)initialize {