module Concurrent

def self.mutex_owned_per_thread?

@!visibility private
def self.mutex_owned_per_thread?
  return false if Concurrent.on_jruby? || Concurrent.on_truffleruby?
  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