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

ruby-concurrency / concurrent-ruby / #2937

05 Oct 2014 10:16PM UTC coverage: 90.686% (-4.1%) from 94.81%
#2937

push

jdantonio
Merge pull request #158 from obrok/promise-composition

Promise composition

15 of 15 new or added lines in 1 file covered. (100.0%)

145 existing lines in 16 files now uncovered.

2775 of 3060 relevant lines covered (90.69%)

316.23 hits per line

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

62.5
/lib/concurrent/atomic.rb
1
#####################################################################
2
# Attempt to check for the deprecated ruby-atomic gem and warn the
3
# user that they should use the new implementation instead.
4

5
if defined?(Atomic)
1✔
6
  warn <<-RUBY
×
7
[ATOMIC] Detected an `Atomic` class, which may indicate a dependency
8
on the ruby-atomic gem. That gem has been deprecated and merged into
9
the concurrent-ruby gem. Please use the Concurrent::Atomic class for
10
atomic references and not the Atomic class.
11
RUBY
12
end
13
#####################################################################
14

15
require 'concurrent/atomic_reference/concurrent_update_error'
1✔
16
require 'concurrent/atomic_reference/mutex_atomic'
1✔
17

18
begin
19
  # force fallback impl with FORCE_ATOMIC_FALLBACK=1
20
  if /[^0fF]/ =~ ENV['FORCE_ATOMIC_FALLBACK']
1✔
21
    ruby_engine = 'mutex_atomic'
×
22
  else
23
    ruby_engine = defined?(RUBY_ENGINE)? RUBY_ENGINE : 'ruby'
1✔
24
  end
25

26
  require "concurrent/atomic_reference/#{ruby_engine}"
1✔
27
rescue LoadError
28
  warn 'Compiled extensions not installed, pure Ruby Atomic will be used.'
×
29
end
30

31
if defined? Concurrent::JavaAtomic
1✔
32

33
  # @!macro [attach] atomic_reference
34
  #
35
  #   An object reference that may be updated atomically.
36
  #
37
  #       Testing with ruby 2.1.2
38
  #       
39
  #       *** Sequential updates ***
40
  #                        user     system      total        real
41
  #       no lock      0.000000   0.000000   0.000000 (  0.005502)
42
  #       mutex        0.030000   0.000000   0.030000 (  0.025158)
43
  #       MutexAtomic  0.100000   0.000000   0.100000 (  0.103096)
44
  #       CAtomic      0.040000   0.000000   0.040000 (  0.034012)
45
  #       
46
  #       *** Parallel updates ***
47
  #                        user     system      total        real
48
  #       no lock      0.010000   0.000000   0.010000 (  0.009387)
49
  #       mutex        0.030000   0.010000   0.040000 (  0.032545)
50
  #       MutexAtomic  0.830000   2.280000   3.110000 (  2.146622)
51
  #       CAtomic      0.040000   0.000000   0.040000 (  0.038332)
52
  #
53
  #       Testing with jruby 1.9.3
54
  #       
55
  #       *** Sequential updates ***
56
  #                        user     system      total        real
57
  #       no lock      0.170000   0.000000   0.170000 (  0.051000)
58
  #       mutex        0.370000   0.010000   0.380000 (  0.121000)
59
  #       MutexAtomic  1.530000   0.020000   1.550000 (  0.471000)
60
  #       JavaAtomic   0.370000   0.010000   0.380000 (  0.112000)
61
  #       
62
  #       *** Parallel updates ***
63
  #                        user     system      total        real
64
  #       no lock      0.390000   0.000000   0.390000 (  0.105000)
65
  #       mutex        0.480000   0.040000   0.520000 (  0.145000)
66
  #       MutexAtomic  1.600000   0.180000   1.780000 (  0.511000)
67
  #       JavaAtomic   0.460000   0.010000   0.470000 (  0.131000)
68
  #
69
  #   @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicReference.html
70
  #   @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/package-summary.html
UNCOV
71
  class Concurrent::Atomic < Concurrent::JavaAtomic
×
72
  end
73

74
elsif defined? Concurrent::RbxAtomic
1✔
75

76
  # @!macro atomic_reference
77
  class Concurrent::Atomic < Concurrent::RbxAtomic
×
78
  end
79

80
elsif Concurrent.allow_c_native_class?('CAtomic')
1✔
81

82
  # @!macro atomic_reference
83
  class Concurrent::Atomic < Concurrent::CAtomic
1✔
84
  end
85

86
else
87

88
  # @!macro atomic_reference
89
  class Concurrent::Atomic < Concurrent::MutexAtomic
×
90
  end
91
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