Skip to content
Back to top
View this page

# Semaphore

class dsviper.Semaphore

  Bases: `object`

  A class used to represent a semaphore. Use the static factory method create(…) or open(…).

  Note: Not directly instantiable.

  static create(name: str) → Semaphore

    Create a semaphore.

  static exists(name: str) → bool

    Return True is the name exist.

  name() → str

    Return the name.

  static open(name: str) → Semaphore

    Open an existing semaphore.

  post() → bool

    The semaphore is unlocked.

  try_wait() → bool

    The semaphore is locked.

  static unlink(name: str) → bool

    Unlink the shared memory object.

  wait() → bool

    The semaphore is locked.