File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ module Concurrent
6
6
# An executor service which runs all operations on the current thread,
7
7
# blocking as necessary. Operations are performed in the order they are
8
8
# received and no two operations can be performed simultaneously.
9
+ #
10
+ # This executor service exists mainly for testing an debugging. When used
11
+ # it immediately runs every `#post` operation on the current thread, blocking
12
+ # that thread until the operation is complete. This can be very beneficial
13
+ # during testing because it makes all operations deterministic.
14
+ #
15
+ # @note Intended for use primarily in testing and debugging.
9
16
class ImmediateExecutor
10
17
include SerialExecutor
11
18
Original file line number Diff line number Diff line change @@ -5,8 +5,18 @@ module Concurrent
5
5
6
6
# An executor service in which every operation spawns a new,
7
7
# independently operating thread.
8
+ #
9
+ # This is perhaps the most inefficient executor service in this
10
+ # library. It exists mainly for testing an debugging. Thread creation
11
+ # and management is expensive in Ruby and this executor performs no
12
+ # resource pooling. This can be very beneficial during testing and
13
+ # debugging because it decouples the using code from the underlying
14
+ # executor implementation. In production this executor will likely
15
+ # lead to suboptimal performance.
16
+ #
17
+ # @note Intended for use primarily in testing and debugging.
8
18
class PerThreadExecutor
9
- include SerialExecutor
19
+ include Executor
10
20
11
21
# Creates a new executor
12
22
def initialize
You can’t perform that action at this time.
0 commit comments