-
Notifications
You must be signed in to change notification settings - Fork 418
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce FiberLocalVar and LockLocalVar for alignment with
Mutex
s…
…cope. # Conflicts: # lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb # spec/concurrent/atomic/reentrant_read_write_lock_spec.rb
- Loading branch information
Showing
8 changed files
with
530 additions
and
713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
lib/concurrent-ruby/concurrent/atomic/java_thread_local_var.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require_relative 'fiber_local_var' | ||
require_relative 'thread_local_var' | ||
|
||
module Concurrent | ||
def self.mutex_owned_per_thread? | ||
mutex = Mutex.new | ||
|
||
# Lock the mutex: | ||
mutex.synchronize do | ||
# Check if the mutex is still owned in a child fiber: | ||
Fiber.new{mutex.owned?}.resume | ||
end | ||
end | ||
|
||
if mutex_owned_per_thread? | ||
LockLocalVar = ThreadLocalVar | ||
else | ||
LockLocalVar = FiberLocalVar | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
181 changes: 0 additions & 181 deletions
181
lib/concurrent-ruby/concurrent/atomic/ruby_thread_local_var.rb
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.