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 1
1
module Concurrent
2
2
3
- # Raised when a complex and atomic operation, such as a transaction,
4
- # is aborted prior to completion.
5
- AbortError = Class . new ( StandardError )
6
-
7
3
# Raised when errors occur during configuration.
8
4
ConfigurationError = Class . new ( StandardError )
9
5
Original file line number Diff line number Diff line change 1
1
require 'set'
2
2
3
- require 'concurrent/errors'
4
3
require 'concurrent/atomic/thread_local_var'
5
4
6
5
module Concurrent
@@ -110,7 +109,7 @@ def atomically
110
109
111
110
begin
112
111
result = yield
113
- rescue Concurrent ::AbortError => e
112
+ rescue Transaction ::AbortError => e
114
113
transaction . abort
115
114
result = Transaction ::ABORTED
116
115
rescue => e
@@ -139,7 +138,7 @@ def atomically
139
138
140
139
# Abort a currently running transaction - see `Concurrent::atomically`.
141
140
def abort_transaction
142
- raise Concurrent ::AbortError . new
141
+ raise Transaction ::AbortError . new
143
142
end
144
143
145
144
module_function :atomically , :abort_transaction
@@ -155,6 +154,8 @@ class Transaction
155
154
ReadLogEntry = Struct . new ( :tvar , :version )
156
155
UndoLogEntry = Struct . new ( :tvar , :value )
157
156
157
+ AbortError = Class . new ( StandardError )
158
+
158
159
def initialize
159
160
@write_set = Set . new
160
161
@read_log = [ ]
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ module Concurrent
129
129
describe '#abort_transaction' do
130
130
131
131
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 )
133
133
end
134
134
135
135
end
You can’t perform that action at this time.
0 commit comments