fiber_pool.rb
Ruby•マスター
Explorer
C40
C++40
C#40
Dart40
Go40
Java40
JavaScript40
Kotlin40
Objective-C40
Perl40
PHP40
Python40
R40
Ruby
初級10
中級10
上級10
エキスパート5
マスター5
meta_dsl.rb
fiber_pool.rb
concern_module.rb
refinement.rb
middleware.rb
Rust40
Shell40
Swift40
TypeScript40
fiber_pool.rb
Click to focus
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class FiberPool↵
def initialize(size = 4)↵
@fibers = size.times.map do↵
Fiber.new do↵
loop do↵
job = Fiber.yield↵
job.call if job↵
end↵
end↵
end↵
end↵
def perform(&block)↵
fiber = @fibers.find(&:alive?)↵
fiber.resume(block) if fiber↵
end↵
end
0WPM•0%•0:00•0/285(0%)|Ln 1, Col 1
UTF-8•Ruby