Skip to content

Commit

Permalink
wip: More tests for Executor
Browse files Browse the repository at this point in the history
  • Loading branch information
jdantonio committed Sep 15, 2013
1 parent 2c15a02 commit fa7d7b3
Show file tree
Hide file tree
Showing 2 changed files with 330 additions and 117 deletions.
10 changes: 8 additions & 2 deletions lib/concurrent/executor.rb
Expand Up @@ -52,23 +52,29 @@ def run
end

def stop
return unless running?
return true unless running?
@mutex.synchronize do
@running = false
@monitor.wakeup if @monitor.alive?
Thread.pass
end
return true
rescue
return false
ensure
@worker = @monitor = nil
end

def kill
return unless running?
return true unless running?
@mutex.synchronize do
@running = false
Thread.kill(@worker) unless @worker.nil?
Thread.kill(@monitor) unless @monitor.nil?
end
return true
rescue
return false
ensure
@worker = @monitor = nil
end
Expand Down

0 comments on commit fa7d7b3

Please sign in to comment.