File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: b1646cbfd908dc948b251e362669af421100647a
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: d6736a1440d42f6af967a8a20ab8d73522112b72
5
- refs/heads/try: 88e157619019894bbd3ecda0e3a1c9be4ce89ad6
5
+ refs/heads/try: 0439162d597d4abfebf93096e71ff45242efe6f0
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
Original file line number Diff line number Diff line change @@ -57,6 +57,16 @@ use libc::c_char;
57
57
#[ cfg( windows) ]
58
58
use str:: OwnedStr ;
59
59
60
+ /// Get the number of cores available
61
+ pub fn num_cpus ( ) -> uint {
62
+ unsafe {
63
+ return rust_get_num_cpus ( ) ;
64
+ }
65
+
66
+ extern {
67
+ fn rust_get_num_cpus ( ) -> libc:: uintptr_t ;
68
+ }
69
+ }
60
70
61
71
pub static TMPBUF_SZ : uint = 1000 u;
62
72
static BUF_BYTES : uint = 2048 u;
@@ -1762,6 +1772,11 @@ mod tests {
1762
1772
n
1763
1773
}
1764
1774
1775
+ #[ test]
1776
+ fn test_num_cpus ( ) {
1777
+ assert ! ( os:: num_cpus( ) > 0 ) ;
1778
+ }
1779
+
1765
1780
#[ test]
1766
1781
fn test_setenv ( ) {
1767
1782
let n = make_rand_name ( ) ;
Original file line number Diff line number Diff line change 11
11
use from_str:: FromStr ;
12
12
use from_str:: from_str;
13
13
use libc:: uintptr_t;
14
- use libc;
15
14
use option:: { Some , None , Option } ;
16
15
use os;
17
16
use str:: Str ;
18
17
use sync:: atomics;
19
18
20
- /// Get the number of cores available
21
- pub fn num_cpus ( ) -> uint {
22
- unsafe {
23
- return rust_get_num_cpus ( ) ;
24
- }
25
-
26
- extern {
27
- fn rust_get_num_cpus ( ) -> libc:: uintptr_t ;
28
- }
29
- }
30
-
31
19
/// Dynamically inquire about whether we're running under V.
32
20
/// You should usually not use this unless your test definitely
33
21
/// can't run correctly un-altered. Valgrind is there to help
@@ -81,7 +69,7 @@ pub fn default_sched_threads() -> uint {
81
69
if limit_thread_creation_due_to_osx_and_valgrind ( ) {
82
70
1
83
71
} else {
84
- num_cpus ( )
72
+ os :: num_cpus ( )
85
73
}
86
74
}
87
75
}
You can’t perform that action at this time.
0 commit comments