Skip to content

Commit 23cb3f9

Browse files
committed
make sure sentinel values are ::Objects
1 parent 1e51d2c commit 23cb3f9

File tree

10 files changed

+11
-11
lines changed

10 files changed

+11
-11
lines changed

lib/concurrent/actor/behaviour.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module Actor
4949
# - {RestartingContext} uses
5050
# {include:Actor::Behaviour.restarting_behaviour_definition}
5151
module Behaviour
52-
MESSAGE_PROCESSED = Object.new
52+
MESSAGE_PROCESSED = ::Object.new
5353

5454
require 'concurrent/actor/behaviour/abstract'
5555
require 'concurrent/actor/behaviour/awaits'

lib/concurrent/agent.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class Agent < Synchronization::LockableObject
147147
ERROR_MODES = [:continue, :fail].freeze
148148
private_constant :ERROR_MODES
149149

150-
AWAIT_FLAG = Object.new
150+
AWAIT_FLAG = ::Object.new
151151
private_constant :AWAIT_FLAG
152152

153153
AWAIT_ACTION = ->(value, latch) { latch.count_down; AWAIT_FLAG }

lib/concurrent/constants.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module Concurrent
33
# Various classes within allows for +nil+ values to be stored,
44
# so a special +NULL+ token is required to indicate the "nil-ness".
55
# @!visibility private
6-
NULL = Object.new
6+
NULL = ::Object.new
77

88
end

lib/concurrent/edge/promises.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ class Channel < Concurrent::Synchronization::Object
19871987
safe_initialization!
19881988

19891989
# Default size of the Channel, makes it accept unlimited number of messages.
1990-
UNLIMITED = Object.new
1990+
UNLIMITED = ::Object.new
19911991
UNLIMITED.singleton_class.class_eval do
19921992
include Comparable
19931993

lib/concurrent/exchanger.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module Concurrent
4141
class AbstractExchanger < Synchronization::Object
4242

4343
# @!visibility private
44-
CANCEL = Object.new
44+
CANCEL = ::Object.new
4545
private_constant :CANCEL
4646

4747
# @!macro [attach] exchanger_method_initialize

lib/concurrent/maybe.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Maybe < Synchronization::Object
108108
# Indicates that the given attribute has not been set.
109109
# When `Just` the {#nothing} getter will return `NONE`.
110110
# When `Nothing` the {#just} getter will return `NONE`.
111-
NONE = Object.new.freeze
111+
NONE = ::Object.new.freeze
112112

113113
# The value of a `Maybe` when `Just`. Will be `NONE` when `Nothing`.
114114
attr_reader :just

lib/concurrent/mvar.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ class MVar < Synchronization::Object
4040
safe_initialization!
4141

4242
# Unique value that represents that an `MVar` was empty
43-
EMPTY = Object.new
43+
EMPTY = ::Object.new
4444

4545
# Unique value that represents that an `MVar` timed out before it was able
4646
# to produce a value.
47-
TIMEOUT = Object.new
47+
TIMEOUT = ::Object.new
4848

4949
# Create a new `MVar`, either empty or with an initial value.
5050
#

lib/concurrent/tvar.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def leave_transaction
162162

163163
class Transaction
164164

165-
ABORTED = Object.new
165+
ABORTED = ::Object.new
166166

167167
ReadLogEntry = Struct.new(:tvar, :version)
168168

spec/concurrent/future_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def get_ivar_from_args(opts)
380380
context 'deadlock avoidance' do
381381

382382
def reentrant_observer(future)
383-
obs = Object.new
383+
obs = ::Object.new
384384
obs.define_singleton_method(:update) do |time, value, reason|
385385
@value = future.value
386386
end

spec/concurrent/ivar_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def trigger_observable(observable)
110110
context 'deadlock avoidance' do
111111

112112
def reentrant_observer(i)
113-
obs = Object.new
113+
obs = ::Object.new
114114
obs.define_singleton_method(:update) do |time, value, reason|
115115
@value = i.value
116116
end

0 commit comments

Comments
 (0)