This file is indexed.

/usr/lib/ruby/vendor_ruby/thread_order/mutex.rb is in ruby-thread-order 1.1.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
class ThreadOrder
  Mutex = if defined? ::Mutex
    # On 1.9 and up, this is in core, so we just use the real one
    ::Mutex
  else

    # On 1.8.7, it's in the stdlib.
    # We don't want to load the stdlib, b/c this is a test tool, and can affect the test environment,
    # causing tests to pass where they should fail.
    #
    # So we're transcribing/modifying it from https://github.com/ruby/ruby/blob/v1_8_7_374/lib/thread.rb#L56
    # Some methods we don't need are deleted.
    # Anything I don't understand (there's quite a bit, actually) is left in.
    Class.new do
      def initialize
        @waiting = []
        @locked = false;
        @waiting.taint
        self.taint
      end

      def lock
        while (Thread.critical = true; @locked)
          @waiting.push Thread.current
          Thread.stop
        end
        @locked = true
        Thread.critical = false
        self
      end

      def unlock
        return unless @locked
        Thread.critical = true
        @locked = false
        begin
          t = @waiting.shift
          t.wakeup if t
        rescue ThreadError
          retry
        end
        Thread.critical = false
        begin
          t.run if t
        rescue ThreadError
        end
        self
      end

      def synchronize
        lock
        begin
          yield
        ensure
          unlock
        end
      end
    end
  end
end