Sha256: 28f54a7e1f1829a4c48681aaefe1933a597c18f6063087b79fb0ac991d873587
Contents?: true
Size: 336 Bytes
Versions: 4
Compression:
Stored size: 336 Bytes
Contents
module PromisePool class Task < Struct.new(:job, :mutex, :thread, :cancelled) # this should never fail def call working_thread mutex.synchronize do return if cancelled self.thread = working_thread end job.call true end def cancel self.cancelled = true end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
promise_pool-0.9.2 | lib/promise_pool/task.rb |
promise_pool-0.9.1 | lib/promise_pool/task.rb |
promise_pool-0.9.0 | lib/promise_pool/task.rb |
promise_pool-0.1.0 | lib/promise_pool/task.rb |