Method: XThread::RBMonitorMixin#mon_try_enter

Defined in:
lib/xthread/monitor.rb

#mon_try_enterObject Also known as: try_mon_enter

Attempts to enter exclusive section. Returns false if lock fails.



161
162
163
164
165
166
167
168
169
170
# File 'lib/xthread/monitor.rb', line 161

def mon_try_enter
  if @mon_owner != Thread.current
	unless @mon_mutex.try_lock
	  return false
	end
	@mon_owner = Thread.current
  end
  @mon_count += 1
  return true
end