Heart
1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
async.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2018-2025 QuasarApp.
3
* Distributed under the lgplv3 software license, see the accompanying
4
* Everyone is permitted to copy and distribute verbatim copies
5
* of this license document, but changing it is not allowed.
6
*/
7
8
#ifndef ASYNC_H
9
#define ASYNC_H
10
#include <QObject>
11
#include <functional>
12
#include "
config.h
"
13
#include "heart_global.h"
14
15
namespace
QH
{
16
25
class
HEARTSHARED_EXPORT
Async
:
public
QObject {
26
27
Q_OBJECT
28
29
public
:
34
using
Job
= std::function<bool()>;
35
44
bool
asyncLauncher
(
const
Job
&job,
bool
await =
false
,
bool
freaze =
true
)
const
;
45
46
protected
:
54
Async
(QThread* thread);
55
60
~Async
();
61
69
bool
waitFor
(
bool
* condition,
int
timeout =
WAIT_TIME
,
bool
freaze =
true
)
const
;
70
78
bool
waitFor
(
const
Job
&condition,
int
timeout =
WAIT_TIME
,
bool
freaze =
true
)
const
;
79
80
private
slots:
81
137
void
asyncHandler (
QH::Async::Job
job,
138
bool
* endOfWork =
nullptr
,
139
bool
* resultOfWork =
nullptr
)
const
;
140
141
142
private
:
149
void
threadAnalize(QThread* thread);
150
};
151
152
}
153
154
Q_DECLARE_METATYPE
(
QH::Async::Job
)
155
#endif
// ASYNC_H
QH::Async::Job
std::function< bool()> Job
Definition
async.h:34
QH::Async::Async
Async(QThread *thread)
Async This is default constructor of the async object.
Definition
async.cpp:38
QH::Async::waitFor
bool waitFor(bool *condition, int timeout=WAIT_TIME, bool freaze=true) const
waitFor This is base wait function.
Definition
async.cpp:67
QH::Async::asyncLauncher
bool asyncLauncher(const Job &job, bool await=false, bool freaze=true) const
asyncLauncher This method invoke a job on the thread (using the asyncHandler method) of this object.
Definition
async.cpp:78
config.h
WAIT_TIME
#define WAIT_TIME
Definition
config.h:13
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QH::HostAddress)
QH
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition
heart.cpp:13
src
public
async.h
Generated by
1.18.0