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