Name
MonitorMixin — Exclusive monitor section mix-in module
Synopsis
Adds monitor functionality to an arbitrary object by mixing the
modules with include
.
Required Library
require ‘monitor’
Instance Methods
m
.mon_enter
Enters exclusive section.
m
.mon_exit
Leaves exclusive section.
m
.mon_owner
Returns the thread that owns the monitor.
m
.mon_synchronize{
...
}
Enters exclusive section and executes the block. Leaves the exclusive section automatically when the block exits.
m
.try_mon_enter
Attempts to enter exclusive section. Returns
false
if lock fails.
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.