mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* prelude.rb, .document: Stuff in prelude.rb should be documented
as well. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									cd492563f8
								
							
						
					
					
						commit
						a828a658a4
					
				
					 3 changed files with 21 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -6,6 +6,9 @@
 | 
			
		|||
# Process all the C source files
 | 
			
		||||
*.c
 | 
			
		||||
 | 
			
		||||
# prelude
 | 
			
		||||
prelude.rb
 | 
			
		||||
 | 
			
		||||
# the lib/ directory (which has its own .document file)
 | 
			
		||||
 | 
			
		||||
lib
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,8 @@
 | 
			
		|||
Mon Mar 29 21:47:44 2010  Akinori MUSHA  <knu@iDaemons.org>
 | 
			
		||||
 | 
			
		||||
	* prelude.rb, .document: Stuff in prelude.rb should be documented
 | 
			
		||||
	  as well.
 | 
			
		||||
 | 
			
		||||
Mon Mar 29 20:23:05 2010  Keiju Ishitsuka  <keiju@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* lib/matrix.rb(Vector#each2, Vector#collect2): add type check for
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										18
									
								
								prelude.rb
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								prelude.rb
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,7 +1,9 @@
 | 
			
		|||
 | 
			
		||||
# Mutex
 | 
			
		||||
 | 
			
		||||
class Mutex
 | 
			
		||||
  # call-seq:
 | 
			
		||||
  #    mutex.synchronize { ... }
 | 
			
		||||
  #
 | 
			
		||||
  # Obtains a lock, runs the block, and releases the lock when the
 | 
			
		||||
  # block completes.  See the example under Mutex.
 | 
			
		||||
  def synchronize
 | 
			
		||||
    self.lock
 | 
			
		||||
    begin
 | 
			
		||||
| 
						 | 
				
			
			@ -12,10 +14,16 @@ class Mutex
 | 
			
		|||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
# Thread
 | 
			
		||||
 | 
			
		||||
class Thread
 | 
			
		||||
  # :nodoc:
 | 
			
		||||
  MUTEX_FOR_THREAD_EXCLUSIVE = Mutex.new
 | 
			
		||||
 | 
			
		||||
  # call-seq:
 | 
			
		||||
  #    Thread.exclusive { block }   => obj
 | 
			
		||||
  #  
 | 
			
		||||
  # Wraps a block in Thread.critical, restoring the original value
 | 
			
		||||
  # upon exit from the critical section, and returns the value of the
 | 
			
		||||
  # block.
 | 
			
		||||
  def self.exclusive
 | 
			
		||||
    MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{
 | 
			
		||||
      yield
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue