File tree Expand file tree Collapse file tree 3 files changed +5
-8
lines changed
Expand file tree Collapse file tree 3 files changed +5
-8
lines changed Original file line number Diff line number Diff line change 11module Concurrent
22
3- # Raised when a complex and atomic operation, such as a transaction,
4- # is aborted prior to completion.
5- AbortError = Class . new ( StandardError )
6-
73 # Raised when errors occur during configuration.
84 ConfigurationError = Class . new ( StandardError )
95
Original file line number Diff line number Diff line change 11require 'set'
22
3- require 'concurrent/errors'
43require 'concurrent/atomic/thread_local_var'
54
65module Concurrent
@@ -110,7 +109,7 @@ def atomically
110109
111110 begin
112111 result = yield
113- rescue Concurrent ::AbortError => e
112+ rescue Transaction ::AbortError => e
114113 transaction . abort
115114 result = Transaction ::ABORTED
116115 rescue => e
@@ -139,7 +138,7 @@ def atomically
139138
140139 # Abort a currently running transaction - see `Concurrent::atomically`.
141140 def abort_transaction
142- raise Concurrent ::AbortError . new
141+ raise Transaction ::AbortError . new
143142 end
144143
145144 module_function :atomically , :abort_transaction
@@ -155,6 +154,8 @@ class Transaction
155154 ReadLogEntry = Struct . new ( :tvar , :version )
156155 UndoLogEntry = Struct . new ( :tvar , :value )
157156
157+ AbortError = Class . new ( StandardError )
158+
158159 def initialize
159160 @write_set = Set . new
160161 @read_log = [ ]
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ module Concurrent
129129 describe '#abort_transaction' do
130130
131131 it 'raises an exception outside an #atomically block' do
132- expect { Concurrent ::abort_transaction } . to raise_error ( Concurrent ::AbortError )
132+ expect { Concurrent ::abort_transaction } . to raise_error ( Concurrent ::Transaction :: AbortError )
133133 end
134134
135135 end
You can’t perform that action at this time.
0 commit comments