Module: GitRunner::Threading

Extended by:
Threading
Included in:
Threading
Defined in:
lib/git-runner/threading.rb

Instance Method Summary collapse

Instance Method Details

#joinObject



15
16
17
18
19
# File 'lib/git-runner/threading.rb', line 15

def join
  # TODO: Timeout with failure alerts

  thread_group.list.each(&:join)
end

#spawnObject

Raises:

  • (ThreadError)


6
7
8
9
# File 'lib/git-runner/threading.rb', line 6

def spawn
  raise ThreadError.new('must be called with a block') unless block_given?
  thread_group.add(Thread.new { yield })
end

#thread_groupObject



11
12
13
# File 'lib/git-runner/threading.rb', line 11

def thread_group
  @thread_group ||= ThreadGroup.new
end