Skip to content

Commit 98c2f9b

Browse files
committed
Better executor documentation.
1 parent d6b9bee commit 98c2f9b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/concurrent/executor/immediate_executor.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ module Concurrent
66
# An executor service which runs all operations on the current thread,
77
# blocking as necessary. Operations are performed in the order they are
88
# 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.
916
class ImmediateExecutor
1017
include SerialExecutor
1118

lib/concurrent/executor/per_thread_executor.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@ module Concurrent
55

66
# An executor service in which every operation spawns a new,
77
# 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.
818
class PerThreadExecutor
9-
include SerialExecutor
19+
include Executor
1020

1121
# Creates a new executor
1222
def initialize

0 commit comments

Comments
 (0)