[DOC] Surface existing MonitorMixin documentation

This commit is contained in:
Marco Costa 2022-12-23 14:00:47 -08:00 committed by Nobuyoshi Nakada
parent adc29351f7
commit 5e54c57d83
Notes: git 2022-12-26 08:40:29 +00:00

View File

@ -7,17 +7,19 @@
# You can freely distribute/modify this library.
#
require 'monitor.so'
#
# In concurrent programming, a monitor is an object or module intended to be
# used safely by more than one thread. The defining characteristic of a
# monitor is that its methods are executed with mutual exclusion. That is, at
# used safely by more than one thread. The defining characteristic of a
# monitor is that its methods are executed with mutual exclusion. That is, at
# each point in time, at most one thread may be executing any of its methods.
# This mutual exclusion greatly simplifies reasoning about the implementation
# of monitors compared to reasoning about parallel code that updates a data
# structure.
#
# You can read more about the general principles on the Wikipedia page for
# Monitors[https://en.wikipedia.org/wiki/Monitor_%28synchronization%29]
# Monitors[https://en.wikipedia.org/wiki/Monitor_%28synchronization%29].
#
# == Examples
#
@ -48,7 +50,7 @@
# end
#
# The consumer thread waits for the producer thread to push a line to buf
# while <tt>buf.empty?</tt>. The producer thread (main thread) reads a
# while <tt>buf.empty?</tt>. The producer thread (main thread) reads a
# line from ARGF and pushes it into buf then calls <tt>empty_cond.signal</tt>
# to notify the consumer thread of new data.
#
@ -86,9 +88,6 @@
# This Class is implemented as subclass of Array which includes the
# MonitorMixin module.
#
require 'monitor.so'
module MonitorMixin
#
# FIXME: This isn't documented in Nutshell.