mutex.h
#ifndef XF_MUTEX_DEFAULT_QT_H
#define XF_MUTEX_DEFAULT_QT_H
#include <config/xf-config.h>
#if (USE_XF_IDF_QT_MUTEX_CLASS != 0)
#include <stdint.h>
#include <QMutex>
#include "xf/interface/mutex.h"
class XFMutex : public interface::XFMutex
{
friend class interface::XFMutex;
public:
void lock() override;
void unlock() override;
bool tryLock(int32_t timeout = 0) override;
protected:
XFMutex() = default;
protected:
QMutex mutex_;
};
// end of port_idf_qt group
#endif // USE_XF_IDF_QT_MUTEX_CLASS
#endif // XF_MUTEX_DEFAULT_QT_H
XFMutex
Default Qt implementation for the XFMutex interface.
Definition: mutex.h:20
XFMutex::lock
void lock() override
Blocks until the mutex becomes available.
XFMutex::XFMutex
XFMutex()=default
Do not allow to directly create an object of this class. Call interface::XFMutex::create() instead.
XFMutex::mutex_
QMutex mutex_
The real mutex.
Definition: mutex.h:33
XFMutex::tryLock
bool tryLock(int32_t timeout=0) override
Tries to get the mutex.
XFMutex::unlock
void unlock() override
Releases the mutex so it can be taken by other threads.
interface::XFMutex
Mutex interface needed by the XF to access a mutex.
Definition: mutex.h:18