Module: Asgard::Base::Dispatch::ClassMethods

Defined in:
lib/asgard/base/dispatch.rb

Instance Method Summary collapse

Instance Method Details

#_condObject



27
28
29
# File 'lib/asgard/base/dispatch.rb', line 27

def _cond
  @_cond ||= Hash.new { |h, k| h[k] = ConditionVariable.new }
end

#_doneObject



23
24
25
# File 'lib/asgard/base/dispatch.rb', line 23

def _done
  @_done ||= Set.new
end

#_ran_mutexObject



38
39
40
# File 'lib/asgard/base/dispatch.rb', line 38

def _ran_mutex
  @_ran_mutex ||= Mutex.new
end

#_reset_ran!Object

Reset execution tracking for a fresh asgard invocation.



43
44
45
46
47
48
49
50
# File 'lib/asgard/base/dispatch.rb', line 43

def _reset_ran!
  _ran_mutex.synchronize do
    @_running = Set.new
    @_done    = Set.new
    @_cond    = Hash.new { |h, k| h[k] = ConditionVariable.new }
    @_results = {}
  end
end

#_resultsObject

Completed tasks' return values, keyed by task name — lets a task already run by one thread hand its result to another thread that shares the dependency, without either touching self.



34
35
36
# File 'lib/asgard/base/dispatch.rb', line 34

def _results
  @_results ||= {}
end

#_runningObject



19
20
21
# File 'lib/asgard/base/dispatch.rb', line 19

def _running
  @_running ||= Set.new
end