class MGit::Lock

Public Class Methods

mutex_exec() { || ... } click to toggle source

@!scope 互斥执行锁 @example mutex_exec do

exec..

end

# File lib/m-git/foundation/lock.rb, line 11
def mutex_exec
  @mutex = Mutex.new if @mutex.nil?
  @mutex.lock
  yield if block_given?
  @mutex.unlock
end
mutex_puts() { || ... } click to toggle source

@!scope 互斥显示锁 @example mutex_puts do

exec..

end

# File lib/m-git/foundation/lock.rb, line 23
def mutex_puts
  @mutex_puts = Mutex.new if @mutex_puts.nil?
  @mutex_puts.lock
  yield if block_given?
  @mutex_puts.unlock
end