Skip to content

Commit c782b26

Browse files
authored
Merge pull request #549 from graaff/alpha-processor-count-support
Support Alpha architecture for processor_count
2 parents 83718fc + af059a7 commit c782b26

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Support Alpha with `Concurrent::processor_count`
2+
13
## Current Release v1.0.2 (2 May 2016)
24

35
* Fix bug with `Concurrent::Map` MRI backend `#inspect` method

lib/concurrent/utility/processor_counter.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def initialize
2828
# processor", which taked into account hyperthreading.
2929
#
3030
# * AIX: /usr/sbin/pmcycles (AIX 5+), /usr/sbin/lsdev
31+
# * Alpha: /usr/bin/nproc (/proc/cpuinfo exists but cannot be used)
3132
# * BSD: /sbin/sysctl
3233
# * Cygwin: /proc/cpuinfo
3334
# * Darwin: /usr/bin/hwprefs, /usr/sbin/sysctl
@@ -84,6 +85,8 @@ def compute_processor_count
8485
result = WIN32OLE.connect("winmgmts://").ExecQuery(
8586
"select NumberOfLogicalProcessors from Win32_Processor")
8687
result.to_enum.collect(&:NumberOfLogicalProcessors).reduce(:+)
88+
elsif File.executable?("/usr/bin/nproc")
89+
IO.popen("/usr/bin/nproc --all").read.to_i
8790
elsif File.readable?("/proc/cpuinfo")
8891
IO.read("/proc/cpuinfo").scan(/^processor/).size
8992
elsif File.executable?("/usr/bin/hwprefs")

0 commit comments

Comments
 (0)