Class: Mutant::Parallel::Driver Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Driver for parallelized execution

Instance Method Summary collapse

Constructor Details

#initialize(**attributes) ⇒ Driver

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Driver.



17
18
19
20
# File 'lib/mutant/parallel/driver.rb', line 17

def initialize(**attributes)
  @alive = true
  super
end

Instance Method Details

#stopself

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Stop parallel computation

This will cause all work to be immediately stopped.

Returns:

  • (self)


39
# File 'lib/mutant/parallel/driver.rb', line 39

def stop = tap { @alive = false; threads.each(&:kill) }

#wait_timeout(timeout) ⇒ Variable::Result<Sink#status>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Wait for computation to finish, with timeout

Parameters:

  • timeout (Float)

Returns:



28
29
30
31
32
# File 'lib/mutant/parallel/driver.rb', line 28

def wait_timeout(timeout)
  var_final.take_timeout(timeout) if @alive

  finalize(status)
end