Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../proc/self/root/usr/share/ruby
File: mutex_m.rb
# frozen_string_literal: false
[0] Fix | Delete
#
[1] Fix | Delete
# mutex_m.rb -
[2] Fix | Delete
# $Release Version: 3.0$
[3] Fix | Delete
# $Revision: 1.7 $
[4] Fix | Delete
# Original from mutex.rb
[5] Fix | Delete
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
[6] Fix | Delete
# modified by matz
[7] Fix | Delete
# patched by akira yamada
[8] Fix | Delete
#
[9] Fix | Delete
# --
[10] Fix | Delete
[11] Fix | Delete
# = mutex_m.rb
[12] Fix | Delete
#
[13] Fix | Delete
# When 'mutex_m' is required, any object that extends or includes Mutex_m will
[14] Fix | Delete
# be treated like a Mutex.
[15] Fix | Delete
#
[16] Fix | Delete
# Start by requiring the standard library Mutex_m:
[17] Fix | Delete
#
[18] Fix | Delete
# require "mutex_m.rb"
[19] Fix | Delete
#
[20] Fix | Delete
# From here you can extend an object with Mutex instance methods:
[21] Fix | Delete
#
[22] Fix | Delete
# obj = Object.new
[23] Fix | Delete
# obj.extend Mutex_m
[24] Fix | Delete
#
[25] Fix | Delete
# Or mixin Mutex_m into your module to your class inherit Mutex instance
[26] Fix | Delete
# methods.
[27] Fix | Delete
#
[28] Fix | Delete
# class Foo
[29] Fix | Delete
# include Mutex_m
[30] Fix | Delete
# # ...
[31] Fix | Delete
# end
[32] Fix | Delete
# obj = Foo.new
[33] Fix | Delete
# # this obj can be handled like Mutex
[34] Fix | Delete
#
[35] Fix | Delete
module Mutex_m
[36] Fix | Delete
def Mutex_m.define_aliases(cl) # :nodoc:
[37] Fix | Delete
cl.module_eval %q{
[38] Fix | Delete
alias locked? mu_locked?
[39] Fix | Delete
alias lock mu_lock
[40] Fix | Delete
alias unlock mu_unlock
[41] Fix | Delete
alias try_lock mu_try_lock
[42] Fix | Delete
alias synchronize mu_synchronize
[43] Fix | Delete
}
[44] Fix | Delete
end
[45] Fix | Delete
[46] Fix | Delete
def Mutex_m.append_features(cl) # :nodoc:
[47] Fix | Delete
super
[48] Fix | Delete
define_aliases(cl) unless cl.instance_of?(Module)
[49] Fix | Delete
end
[50] Fix | Delete
[51] Fix | Delete
def Mutex_m.extend_object(obj) # :nodoc:
[52] Fix | Delete
super
[53] Fix | Delete
obj.mu_extended
[54] Fix | Delete
end
[55] Fix | Delete
[56] Fix | Delete
def mu_extended # :nodoc:
[57] Fix | Delete
unless (defined? locked? and
[58] Fix | Delete
defined? lock and
[59] Fix | Delete
defined? unlock and
[60] Fix | Delete
defined? try_lock and
[61] Fix | Delete
defined? synchronize)
[62] Fix | Delete
Mutex_m.define_aliases(singleton_class)
[63] Fix | Delete
end
[64] Fix | Delete
mu_initialize
[65] Fix | Delete
end
[66] Fix | Delete
[67] Fix | Delete
# See Mutex#synchronize
[68] Fix | Delete
def mu_synchronize(&block)
[69] Fix | Delete
@_mutex.synchronize(&block)
[70] Fix | Delete
end
[71] Fix | Delete
[72] Fix | Delete
# See Mutex#locked?
[73] Fix | Delete
def mu_locked?
[74] Fix | Delete
@_mutex.locked?
[75] Fix | Delete
end
[76] Fix | Delete
[77] Fix | Delete
# See Mutex#try_lock
[78] Fix | Delete
def mu_try_lock
[79] Fix | Delete
@_mutex.try_lock
[80] Fix | Delete
end
[81] Fix | Delete
[82] Fix | Delete
# See Mutex#lock
[83] Fix | Delete
def mu_lock
[84] Fix | Delete
@_mutex.lock
[85] Fix | Delete
end
[86] Fix | Delete
[87] Fix | Delete
# See Mutex#unlock
[88] Fix | Delete
def mu_unlock
[89] Fix | Delete
@_mutex.unlock
[90] Fix | Delete
end
[91] Fix | Delete
[92] Fix | Delete
# See Mutex#sleep
[93] Fix | Delete
def sleep(timeout = nil)
[94] Fix | Delete
@_mutex.sleep(timeout)
[95] Fix | Delete
end
[96] Fix | Delete
[97] Fix | Delete
private
[98] Fix | Delete
[99] Fix | Delete
def mu_initialize # :nodoc:
[100] Fix | Delete
@_mutex = Thread::Mutex.new
[101] Fix | Delete
end
[102] Fix | Delete
[103] Fix | Delete
def initialize(*args) # :nodoc:
[104] Fix | Delete
mu_initialize
[105] Fix | Delete
super
[106] Fix | Delete
end
[107] Fix | Delete
end
[108] Fix | Delete
[109] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function