File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed
lib/concurrent-ruby/concurrent Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ def initialize(delegate)
290
290
@delegate = delegate
291
291
@queue = [ ]
292
292
@executor = Concurrent . global_io_executor
293
- @ruby_pid = Process . pid
293
+ @ruby_pid = $$
294
294
end
295
295
296
296
# Delegates method calls to the wrapped object.
@@ -346,9 +346,9 @@ def perform
346
346
end
347
347
348
348
def reset_if_forked
349
- if Process . pid != @ruby_pid
349
+ if $$ != @ruby_pid
350
350
@queue . clear
351
- @ruby_pid = Process . pid
351
+ @ruby_pid = $$
352
352
end
353
353
end
354
354
end
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ def ns_initialize(opts)
138
138
@completed_task_count = 0
139
139
@largest_length = 0
140
140
@workers_counter = 0
141
- @ruby_pid = Process . pid # detects if Ruby has forked
141
+ @ruby_pid = $$ # detects if Ruby has forked
142
142
143
143
@gc_interval = opts . fetch ( :gc_interval , @idletime / 2.0 ) . to_i # undocumented
144
144
@next_gc_time = Concurrent . monotonic_time + @gc_interval
@@ -287,15 +287,15 @@ def ns_prune_pool
287
287
end
288
288
289
289
def ns_reset_if_forked
290
- if Process . pid != @ruby_pid
290
+ if $$ != @ruby_pid
291
291
@queue . clear
292
292
@ready . clear
293
293
@pool . clear
294
294
@scheduled_task_count = 0
295
295
@completed_task_count = 0
296
296
@largest_length = 0
297
297
@workers_counter = 0
298
- @ruby_pid = Process . pid
298
+ @ruby_pid = $$
299
299
end
300
300
end
301
301
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ def ns_initialize(opts)
76
76
@task_executor = Options . executor_from_options ( opts ) || Concurrent . global_io_executor
77
77
@timer_executor = SingleThreadExecutor . new
78
78
@condition = Event . new
79
- @ruby_pid = Process . pid # detects if Ruby has forked
79
+ @ruby_pid = $$ # detects if Ruby has forked
80
80
end
81
81
82
82
# Post the task to the internal queue.
@@ -127,10 +127,10 @@ def ns_shutdown_execution
127
127
end
128
128
129
129
def ns_reset_if_forked
130
- if Process . pid != @ruby_pid
130
+ if $$ != @ruby_pid
131
131
@queue . clear
132
132
@condition . reset
133
- @ruby_pid = Process . pid
133
+ @ruby_pid = $$
134
134
end
135
135
end
136
136
You can’t perform that action at this time.
0 commit comments