• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-concurrency / concurrent-ruby / #2743

04 Mar 2015 02:59AM UTC coverage: 45.152% (-50.4%) from 95.548%
#2743

push

jdantonio
Merge pull request #258 from ruby-concurrency/clock_time

Closes #256

23 of 69 new or added lines in 7 files covered. (33.33%)

1563 existing lines in 88 files now uncovered.

1425 of 3156 relevant lines covered (45.15%)

0.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.33
/lib/concurrent/executor/indirect_immediate_executor.rb
1
require 'concurrent/executor/executor'
1✔
2

3
module Concurrent
1✔
4
  # An executor service which runs all operations on a new thread, blocking
5
  # until it completes. Operations are performed in the order they are received
6
  # and no two operations can be performed simultaneously.
7
  #
8
  # This executor service exists mainly for testing an debugging. When used it
9
  # immediately runs every `#post` operation on a new thread, blocking the
10
  # current thread until the operation is complete. This is similar to how the
11
  # ImmediateExecutor works, but the operation has the full stack of the new
12
  # thread at its disposal. This can be helpful when the operations will spawn
13
  # more operations on the same executor and so on - such a situation might
14
  # overflow the single stack in case of an ImmediateExecutor, which is
15
  # inconsistent with how it would behave for a threaded executor.
16
  #
17
  # @note Intended for use primarily in testing and debugging.
18
  class IndirectImmediateExecutor < ImmediateExecutor
1✔
19
    # Creates a new executor
20
    def initialize
1✔
UNCOV
21
      super
×
UNCOV
22
      @internal_executor = PerThreadExecutor.new
×
23
    end
24

25
    # @!macro executor_method_post
26
    def post(*args, &task)
1✔
UNCOV
27
      raise ArgumentError.new("no block given") unless block_given?
×
UNCOV
28
      return false unless running?
×
29

UNCOV
30
      event = Concurrent::Event.new
×
UNCOV
31
      @internal_executor.post do
×
32
        begin
UNCOV
33
          task.call(*args)
×
34
        ensure
UNCOV
35
          event.set
×
36
        end
37
      end
UNCOV
38
      event.wait
×
39

UNCOV
40
      true
×
41
    end
42
  end
43
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc