#### D.2.11.4 semaphore

Procedure from library `resources.lib` (see resources_lib).

Usage:
  semaphore(n), n int

Return:
  the index of a new semaphore initialized with n.

Example:

    LIB "resources.lib";
    int sem = semaphore(1);
    system("semaphore", "acquire", sem);
    ==> 1
    system("semaphore", "try_acquire", sem);
    ==> 0
    system("semaphore", "release", sem);
    ==> 1
    system("semaphore", "try_acquire", sem);
    ==> 1

User manual for Singular version 4.4.1, 2025, generated by texi2html.