Module: Sqreen::Backport::MutexOwned

Defined in:
lib/sqreen/backport/mutex_owned.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.supported?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/sqreen/backport/mutex_owned.rb', line 10

def supported?
  Mutex.new.respond_to?(:owned?)
end

Instance Method Details

#owned?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/sqreen/backport/mutex_owned.rb', line 15

def owned?
  locked? && synchronize { return false }
rescue ThreadError
  return true
end