class Concurrent::Semaphore

Overview

A semaphore allows execution of at most n tasks simultaneously.

Defined in:

concurrent/semaphore.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(n : Int32) #

Create a semaphore for n concurrent accesses. Will raise if n <= 0.


[View source]

Instance Method Detail

def acquire(&) #

Acquire an item from the semaphore, calling the block, and then safely releasing the semaphore.


[View source]