Skip to content

semaphore semaphore

Alairion edited this page May 8, 2021 · 4 revisions

nes::semaphore::semaphore

Functions

(1) explicit semaphore(std::size_t initial_count = 0);
(2) semaphore(const semaphore&) = delete;
(3) semaphore(semaphore&& other) noexcept = delete;
  1. Constructs a new semaphore object with initial_count resources available.
  2. Deleted copy-constructor.
  3. Deleted move-constructor.

Parameters

Name Description
initial_count The count of resources available right after construction. The default value is 0

Complexity

  1. Explicit.

Exceptions

  1. May throw a std::runtime_error if the semaphore can not be created.
  2. Deleted.
  3. Deleted.

Implementation details

  1. On Windows, the semaphore is created using CreateSemaphoreW
    On Posix systems, the semaphore is created using sem_init
Clone this wiki locally