Class: Webhookdb::Concurrent::Pool
- Inherits:
-
Object
- Object
- Webhookdb::Concurrent::Pool
- Defined in:
- lib/webhookdb/concurrent.rb
Overview
Baseclass for pools for doing work across threads. Note that these concurrent pools are not for repeated use, like a normal threadpool. They are for ‘fanning out’ a single operation across multiple threads.
Tasks should not error; if they error, the pool will becomes inoperable: post
and join
will re-raise the first task error.
Direct Known Subclasses
Instance Method Summary collapse
-
#join ⇒ Object
Wait for all work to finish.
-
#post ⇒ Object
Add work to the pool.
Instance Method Details
#join ⇒ Object
Wait for all work to finish. Re-raise the first exception for any pool error.
23 |
# File 'lib/webhookdb/concurrent.rb', line 23 def join = raise NotImplementedError |
#post ⇒ Object
Add work to the pool. Will block if no workers are free. Re-raises the pool’s error if the pool has an error. This is important as we don’t want the caller to keep adding work, if the pool is inoperable.
19 |
# File 'lib/webhookdb/concurrent.rb', line 19 def post(&) = raise NotImplementedError |