Module: Mutant::Parallel Private

Defined in:
lib/mutant/parallel.rb,
lib/mutant/parallel/driver.rb,
lib/mutant/parallel/source.rb,
lib/mutant/parallel/worker.rb

Overview

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

Parallel execution engine of arbitrary payloads

Defined Under Namespace

Classes: Config, Driver, Sink, Source, Status, Worker

Class Method Summary collapse

Class Method Details

.async(config) ⇒ 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.

Run async computation returning driver



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mutant/parallel.rb', line 12

def self.async(config)
  shared = {
    var_active_jobs: shared(Variable::IVar, config, value: Set.new),
    var_final:       shared(Variable::IVar, config),
    var_sink:        shared(Variable::IVar, config, value: config.sink)
  }

  Driver.new(
    threads: threads(config, worker(config, **shared)),
    **shared
  )
end

.worker(config, **shared) ⇒ Worker

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.

The worker



30
31
32
33
34
35
36
37
# File 'lib/mutant/parallel.rb', line 30

def self.worker(config, **shared)
  Worker.new(
    processor:   config.processor,
    var_running: shared(Variable::MVar, config, value: config.jobs),
    var_source:  shared(Variable::IVar, config, value: config.source),
    **shared
  )
end