Skip to content

Mutex

Base classes

Name Children Inherits
QMutex
PySide6.QtCore
QMutex(self, /) -> None

⋔ Inheritance diagram

graph TD
  3132001788["core.Mutex"]
  3955889922["QtCore.QMutex"]
  501432601["QtCore.QBasicMutex"]
  37984305["Shiboken.Object"]
  2751680898["builtins.object"]
  3955889922 --> 3132001788
  501432601 --> 3955889922
  37984305 --> 501432601
  2751680898 --> 37984305

🛈 DocStrings

Bases: QMutex

Access serialization between threads.

Source code in prettyqt/core/mutex.py
class Mutex(QtCore.QMutex):
    """Access serialization between threads."""

    @contextlib.contextmanager
    def lock_mutex(self, timeout: int | None = None):
        if timeout is None:
            timeout = -1
        acquired = self.tryLock(timeout)
        try:
            yield acquired
        finally:
            if acquired:
                self.unlock()

:fa-brands-github: Show source on GitHub