Class: Autobuild::RakeTaskParallelism::JobServer

Inherits:
Object
  • Object
show all
Defined in:
lib/autobuild/parallel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#rioObject (readonly)

Returns the value of attribute rio.



10
11
12
# File 'lib/autobuild/parallel.rb', line 10

def rio
  @rio
end

#wioObject (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