Skip to content

Semaphore

Qt Base Class: QSemaphore

Signature: QSemaphore(self, n: int = 0) -> None

Base classes

Name Children Inherits
QSemaphore
PySide6.QtCore
QSemaphore(self, n: int \= 0) -> None

⋔ Inheritance diagram

graph TD
  1473299759392["core.Semaphore"]
  1473243782272["QtCore.QSemaphore"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473243782272 --> 1473299759392
  1473291690208 --> 1473243782272
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QSemaphore

General counting semaphore.

Source code in prettyqt\core\semaphore.py
class Semaphore(QtCore.QSemaphore):
    """General counting semaphore."""

    @contextlib.contextmanager
    def acquire_resources(self, n: int = 1) -> Generator[bool, None, None]:
        yield self.tryAcquire(n)
        self.release(n)