6511ed4345
Ruby often idomaticaly uses blocks to open a resource and close it again automatically. For example: file = File.open('file', 'r') # do work with file file.close # vs File.open('file', 'r') do |file| # do work with file end # file closed automatically This teaches semaphores a similar technique: semaphore = Concurrent::Semaphore.new(1) semaphore.acquire # do work semaphore.release # vs semaphore.acquire do # do work end # permit automatically released |
||
---|---|---|
.. | ||
com/concurrent_ruby/ext | ||
ConcurrentRubyService.java |