File tree 3 files changed +11
-3
lines changed
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -930,6 +930,13 @@ rust_begin_unwind(uintptr_t token) {
930
930
#endif
931
931
}
932
932
933
+ extern int get_num_cpus ();
934
+
935
+ extern " C" CDECL uintptr_t
936
+ rust_get_num_cpus () {
937
+ return get_num_cpus ();
938
+ }
939
+
933
940
//
934
941
// Local Variables:
935
942
// mode: C++
Original file line number Diff line number Diff line change @@ -40,15 +40,15 @@ rust_drop_env_lock() {
40
40
}
41
41
42
42
#if defined(__WIN32__)
43
- static int
43
+ int
44
44
get_num_cpus () {
45
45
SYSTEM_INFO sysinfo;
46
46
GetSystemInfo (&sysinfo);
47
47
48
48
return (int ) sysinfo.dwNumberOfProcessors ;
49
49
}
50
50
#elif defined(__BSD__)
51
- static int
51
+ int
52
52
get_num_cpus () {
53
53
/* swiped from http://stackoverflow.com/questions/150355/
54
54
programmatically-find-the-number-of-cores-on-a-machine */
@@ -75,7 +75,7 @@ get_num_cpus() {
75
75
return numCPU;
76
76
}
77
77
#elif defined(__GNUC__)
78
- static int
78
+ int
79
79
get_num_cpus () {
80
80
return sysconf (_SC_NPROCESSORS_ONLN);
81
81
}
Original file line number Diff line number Diff line change @@ -239,3 +239,4 @@ rust_valgrind_stack_deregister
239
239
rust_take_env_lock
240
240
rust_drop_env_lock
241
241
rust_update_log_settings
242
+ rust_get_num_cpus
You can’t perform that action at this time.
0 commit comments