summaryrefslogtreecommitdiff
path: root/ext/monitor/lib/monitor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/monitor/lib/monitor.rb')
-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.