Qmutex destroying locked mutex nbminer

Comment

Author: Admin | 2025-04-28

The QMutexLocker is operating. This is useful for code that needs access to the mutex, such as QWaitCondition::wait(). For example: class SignalWaiter { private: QMutexLocker locker; public: SignalWaiter(QMutex *mutex) : locker(mutex) { } void waitForSignal() { ... while (!signalled) waitCondition.wait(locker.mutex()); ... } };See also QReadLocker, QWriteLocker, and QMutex.Member Function DocumentationQMutexLocker::QMutexLocker(QRecursiveMutex *mutex)Constructs a QMutexLocker and locks mutex. The mutex will be unlocked (unlock() called) when the QMutexLocker is destroyed. If mutex is nullptr, QMutexLocker does nothing.This function was introduced in Qt 5.14.See also QMutex::lock().QMutexLocker::QMutexLocker(QMutex *mutex)Constructs a QMutexLocker and locks mutex. The mutex will be unlocked when the QMutexLocker is destroyed. If mutex is nullptr, QMutexLocker does nothing.See also QMutex::lock().QMutexLocker::~QMutexLocker()Destroys the QMutexLocker and unlocks the mutex that was locked in the constructor.See also QMutex::unlock().QMutex *QMutexLocker::mutex() constReturns the mutex on which the QMutexLocker is operating.void QMutexLocker::relock()Relocks an unlocked mutex locker.See also unlock().void QMutexLocker::unlock()Unlocks this mutex locker. You can use relock() to lock it again. It does not need to be locked when destroyed.See also relock().

Add Comment