mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
78e1defbfe
Previously, a QTimer was used to start processing of our event queue in the main Qt event loop. Unfortunately, QTimers are not thread-safe, and disallow starting of a timer from a different thread than it was created in. Instead, use a dummy QObject to post a custom QEvent to the main loop from whatever thread we like, and process our event queue when it is received by our dummy object.
23 lines
354 B
C++
23 lines
354 B
C++
/*
|
|
* Copyright (c) 2023, Gregory Bertilson <zaggy1024@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <QEvent>
|
|
|
|
#include "EventLoopImplementationQt.h"
|
|
|
|
namespace Ladybird {
|
|
|
|
class EventLoopImplementationQtEventTarget final : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
virtual bool event(QEvent* event) override;
|
|
};
|
|
|
|
}
|