Heart
1.4.918.d927d9c
Heart is base back end library for your c++ Qt projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
asynclauncher.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2021-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
#include "
asynclauncher.h
"
9
10
#include <QThread>
11
namespace
QH
{
12
13
AsyncLauncher::AsyncLauncher
(QThread *thread):
14
Async
(thread) {
15
}
16
17
18
bool
AsyncLauncher::run
(
const
Async::Job
&action,
bool
wait) {
19
if
(thread() && !thread()->isRunning()) {
20
thread()->start();
21
}
22
23
return
asyncLauncher
(action, wait);
24
}
25
26
bool
AsyncLauncher::stop
() {
27
if
(thread() && thread()->isRunning()) {
28
thread()->exit();
29
}
30
31
return
true
;
32
}
33
34
bool
AsyncLauncher::waitForStop
() {
35
if
(thread() && thread()->isRunning()) {
36
return
thread()->wait();
37
}
38
39
return
true
;
40
}
41
42
}
asynclauncher.h
QH::AsyncLauncher::run
bool run(const Job &action, bool wait=false)
run This method run the action function in the work thread of this object.
Definition
asynclauncher.cpp:18
QH::AsyncLauncher::stop
bool stop()
stop This method stop the work thread of this object.
Definition
asynclauncher.cpp:26
QH::AsyncLauncher::waitForStop
bool waitForStop()
waitForStop This method wait for the thread of this object is stopped.
Definition
asynclauncher.cpp:34
QH::AsyncLauncher::AsyncLauncher
AsyncLauncher(QThread *thread)
AsyncLauncher This is base constructor of the AsyncLauncher object.
Definition
asynclauncher.cpp:13
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::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
QH
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition
heart.cpp:13
src
public
asynclauncher.cpp
Generated by
1.18.0