code: def validate_mutex(mutex)
        return if mutex.respond_to?(:lock) && mutex.respond_to?(:unlock)
        return if mutex.respond_to?(:unlock!)
        raise TypeError, "'mutex' must respond to ('lock' and 'unlock') or 'unlock!'"
      end
docs: Validates that an object behaves like a +::Mutex+
   Must be able to lock and unlock +mutex+.
   @api private
   @param mutex [Mutex] mutex to be validated
   @raise [TypeError] if +mutex+ does not behave like a +::Mutex+
   @return [void]