AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AEventLoop.h
1/*
2 * AUI Framework - Declarative UI toolkit for modern C++20
3 * Copyright (C) 2020-2024 Alex2772 and Contributors
4 *
5 * SPDX-License-Identifier: MPL-2.0
6 *
7 * This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 */
11
12#pragma once
13
14
15#include "IEventLoop.h"
16#include "AMutex.h"
17#include "AConditionVariable.h"
18
23class API_AUI_CORE AEventLoop: public IEventLoop {
24public:
25 ~AEventLoop() override;
26
27 void notifyProcessMessages() override;
28
34 void loop() override;
35
36 void stop() {
37 mRunning = false;
39 }
40
41 /*
42 * @brief One loop iteration.
43 * @details
44 * Useful to define custom loops.
45 *
46 * If no tasks for current thread available, blocks the thread execution.
47 */
48 void iteration();
49
50private:
51 AMutex mMutex;
53 bool mNotified = false;
54 bool mRunning = false;
55};
Represents a condition variable.
Definition AConditionVariable.h:24
Default event loop implementation.
Definition AEventLoop.h:23
virtual void loop()=0
Do message processing loop.
virtual void notifyProcessMessages()=0
Notifies this IEventLoop that its thread got a new message to process.
Basic syscall-based synchronization primitive.
Definition AMutex.h:33