Class: Concurrent::SerializedExecutionDelegator
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Concurrent::SerializedExecutionDelegator
- Includes:
- SerialExecutor
- Defined in:
- lib/concurrent/executor/serialized_execution.rb
Overview
A wrapper/delegator for any ‘Executor` or `ExecutorService` that guarantees serialized execution of tasks.
Instance Method Summary collapse
-
#initialize(executor) ⇒ SerializedExecutionDelegator
constructor
A new instance of SerializedExecutionDelegator.
-
#post(*args) { ... } ⇒ Boolean
Submit a task to the executor for asynchronous processing.
Methods included from SerialExecutor
Methods included from Executor
Constructor Details
#initialize(executor) ⇒ SerializedExecutionDelegator
Returns a new instance of SerializedExecutionDelegator.
113 114 115 116 117 |
# File 'lib/concurrent/executor/serialized_execution.rb', line 113 def initialize(executor) @executor = executor @serializer = SerializedExecution.new super(executor) end |
Instance Method Details
#post(*args) { ... } ⇒ Boolean
Submit a task to the executor for asynchronous processing.
120 121 122 123 124 |
# File 'lib/concurrent/executor/serialized_execution.rb', line 120 def post(*args, &task) raise ArgumentError.new('no block given') unless block_given? return false unless running? @serializer.post(@executor, *args, &task) end |