Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7029b006cc9d
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b8f531d911a7
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Nov 3, 2014

  1. Add Etc::nprocessors

    cheald committed Nov 3, 2014
    Copy the full SHA
    077c4ff View commit details

Commits on Nov 4, 2014

  1. Merge pull request #2083 from cheald/etc_nprocessors

    Add Etc::nprocessors
    headius committed Nov 4, 2014
    Copy the full SHA
    b8f531d View commit details
Showing with 7 additions and 0 deletions.
  1. +7 −0 core/src/main/java/org/jruby/ext/etc/RubyEtc.java
7 changes: 7 additions & 0 deletions core/src/main/java/org/jruby/ext/etc/RubyEtc.java
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
import jnr.posix.POSIX;
import jnr.posix.util.Platform;
import org.jruby.Ruby;
import org.jruby.RubyFixnum;
import org.jruby.RubyModule;
import org.jruby.RubyNumeric;
import org.jruby.RubyString;
@@ -424,6 +425,12 @@ public static IRubyObject sysconfdir(ThreadContext context, IRubyObject recv) {

return ret;
}

@JRubyMethod(module = true)
public static IRubyObject nprocessors(ThreadContext context, IRubyObject recv) {
int nprocs = Runtime.getRuntime().availableProcessors();
return RubyFixnum.newFixnum(context.getRuntime(), nprocs);
}

private static final AtomicBoolean iteratingPasswd = new AtomicBoolean(false);
}