mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
	
		
			219 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
	
		
			219 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # Plenty Thread.pass
 | |
| # A performance may depend on GVL implementation.
 | |
| 
 | |
| tmax = (ARGV.shift || 8).to_i
 | |
| lmax = 400_000 / tmax
 | |
| 
 | |
| (1..tmax).map{
 | |
|   Thread.new{
 | |
|     lmax.times{
 | |
|       Thread.pass
 | |
|     }
 | |
|   }
 | |
| }.each{|t| t.join}
 | |
| 
 | |
| 
 | 
