* remove trailing spaces.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-06-17 22:33:54 +00:00
parent b7a693da8e
commit 7191ea1049
2 changed files with 18 additions and 18 deletions

View File

@ -1,14 +1,14 @@
# = monitor.rb # = monitor.rb
# #
# Copyright (C) 2001 Shugo Maeda <shugo@ruby-lang.org> # Copyright (C) 2001 Shugo Maeda <shugo@ruby-lang.org>
# #
# This library is distributed under the terms of the Ruby license. # This library is distributed under the terms of the Ruby license.
# You can freely distribute/modify this library. # You can freely distribute/modify this library.
# #
require 'thread' require 'thread'
# #
# In concurrent programming, a monitor is an object or module intended to be # 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 # 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 # monitor is that its methods are executed with mutual exclusion. That is, at
@ -19,17 +19,17 @@ require 'thread'
# #
# You can read more about the general principles on the Wikipedia page for # You can read more about the general principles on the Wikipedia page for
# Monitors[http://en.wikipedia.org/wiki/Monitor_%28synchronization%29] # Monitors[http://en.wikipedia.org/wiki/Monitor_%28synchronization%29]
# #
# == Examples # == Examples
# #
# === Simple object.extend # === Simple object.extend
# #
# require 'monitor.rb' # require 'monitor.rb'
# #
# buf = [] # buf = []
# buf.extend(MonitorMixin) # buf.extend(MonitorMixin)
# empty_cond = buf.new_cond # empty_cond = buf.new_cond
# #
# # consumer # # consumer
# Thread.start do # Thread.start do
# loop do # loop do
@ -39,7 +39,7 @@ require 'thread'
# end # end
# end # end
# end # end
# #
# # producer # # producer
# while line = ARGF.gets # while line = ARGF.gets
# buf.synchronize do # buf.synchronize do
@ -47,16 +47,16 @@ require 'thread'
# empty_cond.signal # empty_cond.signal
# end # end
# end # end
# #
# The consumer thread waits for the producer thread to push a line to buf # 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> # line from ARGF and pushes it into buf then calls <tt>empty_cond.signal</tt>
# to notify the consumer thread of new data. # to notify the consumer thread of new data.
# #
# === Simple Class include # === Simple Class include
# #
# require 'monitor' # require 'monitor'
# #
# class SynchronizedArray < Array # class SynchronizedArray < Array
# #
# include MonitorMixin # include MonitorMixin
@ -64,22 +64,22 @@ require 'thread'
# def initialize(*args) # def initialize(*args)
# super(*args) # super(*args)
# end # end
# #
# alias :old_shift :shift # alias :old_shift :shift
# alias :old_unshift :unshift # alias :old_unshift :unshift
# #
# def shift(n=1) # def shift(n=1)
# self.synchronize do # self.synchronize do
# self.old_shift(n) # self.old_shift(n)
# end # end
# end # end
# #
# def unshift(item) # def unshift(item)
# self.synchronize do # self.synchronize do
# self.old_unshift(item) # self.old_unshift(item)
# end # end
# end # end
# #
# # other methods ... # # other methods ...
# end # end
# #
@ -261,7 +261,7 @@ module MonitorMixin
end end
# Use the Monitor class when you want to have a lock object for blocks with # Use the Monitor class when you want to have a lock object for blocks with
# mutual exclusion. # mutual exclusion.
# #
# require 'monitor' # require 'monitor'
# #

View File

@ -1373,7 +1373,7 @@ const_missing(VALUE klass, ID id)
* Invoked when a reference is made to an undefined constant in * Invoked when a reference is made to an undefined constant in
* <i>mod</i>. It is passed a symbol for the undefined constant, and * <i>mod</i>. It is passed a symbol for the undefined constant, and
* returns a value to be used for that constant. The * returns a value to be used for that constant. The
* following code is an example of the same: * following code is an example of the same:
* *
* def Foo.const_missing(name) * def Foo.const_missing(name)
* name # return the constant name as Symbol * name # return the constant name as Symbol