polsih bracket

This commit is contained in:
2023-10-05 11:46:23 +02:00
parent 6bfe6ee059
commit 25f77289d7
3 changed files with 18 additions and 35 deletions

View File

@ -7,23 +7,19 @@
#include <QMutexLocker>
#include "eventqueue.h"
XFEventQueue::XFEventQueue()
{
XFEventQueue::XFEventQueue() {
}
XFEventQueue::~XFEventQueue()
{
XFEventQueue::~XFEventQueue() {
newEvents_.wakeAll();
}
bool XFEventQueue::empty() const
{
bool XFEventQueue::empty() const {
return queue_.isEmpty();
}
bool XFEventQueue::push(const XFEvent * pEvent, bool fromISR)
{
(void)fromISR;
bool XFEventQueue::push(const XFEvent * pEvent, bool fromISR) {
(void)fromISR; // Just for don't have the warning
QMutexLocker locker(&mutex_);
queue_.enqueue(pEvent);
// Tell waiting thread(s) there is again an event present
@ -31,19 +27,16 @@ bool XFEventQueue::push(const XFEvent * pEvent, bool fromISR)
return true;
}
const XFEvent * XFEventQueue::front()
{
const XFEvent * XFEventQueue::front() {
return queue_.front();
}
void XFEventQueue::pop()
{
void XFEventQueue::pop() {
QMutexLocker locker(&mutex_);
queue_.dequeue();
}
bool XFEventQueue::pend()
{
bool XFEventQueue::pend() {
QMutexLocker locker(&mutex_);
// Wait for new events. Mutex needs to be in lock-state
// prior to call wait()!