Class: Autobuild::RakeTaskParallelism::JobServer
- Inherits:
-
Object
- Object
- Autobuild::RakeTaskParallelism::JobServer
- Defined in:
- lib/autobuild/parallel.rb
Instance Attribute Summary collapse
-
#rio ⇒ Object
readonly
Returns the value of attribute rio.
-
#wio ⇒ Object
readonly
Returns the value of attribute wio.
Instance Method Summary collapse
- #get(token_count = 1) ⇒ Object
-
#initialize(level) ⇒ JobServer
constructor
A new instance of JobServer.
- #put(token_count = 1) ⇒ Object
Constructor Details
#initialize(level) ⇒ JobServer
Returns a new instance of JobServer.
12 13 14 15 16 17 18 |
# File 'lib/autobuild/parallel.rb', line 12 def initialize(level) @rio, @wio = IO.pipe # Clearing cloexec rio.fcntl(Fcntl::F_SETFD, 0) wio.fcntl(Fcntl::F_SETFD, 0) put(level) end |
Instance Attribute Details
#rio ⇒ Object (readonly)
Returns the value of attribute rio.
10 11 12 |
# File 'lib/autobuild/parallel.rb', line 10 def rio @rio end |
#wio ⇒ Object (readonly)
Returns the value of attribute wio.
10 11 12 |
# File 'lib/autobuild/parallel.rb', line 10 def wio @wio end |
Instance Method Details
#get(token_count = 1) ⇒ Object
20 21 22 |
# File 'lib/autobuild/parallel.rb', line 20 def get(token_count = 1) @rio.read(token_count) end |
#put(token_count = 1) ⇒ Object
24 25 26 |
# File 'lib/autobuild/parallel.rb', line 24 def put(token_count = 1) @wio.write(" " * token_count) end |