summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMarco Costa <marco.costa@datadoghq.com>2022-12-23 14:00:47 -0800
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-12-26 17:40:11 +0900
commit5e54c57d83949818200bcec069455d713be681ff (patch)
treeb91a6e261c362de3e2e7db7d884f975fe7f31435 /ext
parentadc29351f77cd152374a9156a7f1ce6a1a565bbd (diff)
[DOC] Surface existing MonitorMixin documentation
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7017
Diffstat (limited to 'ext')
-rw-r--r--ext/monitor/lib/monitor.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/monitor/lib/monitor.rb b/ext/monitor/lib/monitor.rb
index 11c5ac17d9..31d6d2b3c4 100644
--- a/ext/monitor/lib/monitor.rb
+++ b/ext/monitor/lib/monitor.rb
@@ -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.