concurrent-ruby/ext/concurrent-ruby
Sam Bostock 6511ed4345
Allow semaphore acquisition with blocks
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
2022-01-20 16:17:38 -05:00
..
com/concurrent_ruby/ext Allow semaphore acquisition with blocks 2022-01-20 16:17:38 -05:00
ConcurrentRubyService.java Building 2018-07-26 15:04:39 +02:00