The Async class This is bundle of async templates and async wrappers.
More...
#include <async.h>
|
| using | Job = std::function<bool()> |
|
| 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.
|
|
| | Async (QThread *thread) |
| | Async This is default constructor of the async object.
|
| | ~Async () |
| bool | waitFor (bool *condition, int timeout=WAIT_TIME, bool freaze=true) const |
| | waitFor This is base wait function.
|
| bool | waitFor (const Job &condition, int timeout=WAIT_TIME, bool freaze=true) const |
| | waitFor This is base wait function.
|
The Async class This is bundle of async templates and async wrappers.
- Note
- If you use this object then you do not need include QObject because this class include the QObject class. Do not forget the Q_OBJECT macross.
-
All objects of this class must be initialized with the . So The constructor is private and the AsynFactyry class is a friend class of the Async class.
Definition at line 25 of file async.h.
◆ Job
The Job is wrapper of the std::function<bool()> type. This type registered like the Qt meta type For using in the qt metasystem.
Definition at line 34 of file async.h.
◆ Async()
| QH::Async::Async |
( |
QThread * | thread | ) |
|
|
protected |
Async This is default constructor of the async object.
- Parameters
-
| thread | This is work thread of the async object. |
| ptr | This is pointer to qtparent of this object. |
- Note
- thread must be a valid thread. It is allowed to use the node worker (main) thread: in this case all jobs are executed directly in that thread.
Definition at line 38 of file async.cpp.
◆ ~Async()
- Note
- This is async distructor. This distructor wait for finishing of the own threads befor delete.
Definition at line 45 of file async.cpp.
◆ asyncLauncher()
| bool QH::Async::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.
- Parameters
-
| job | This is function with needed job. |
| await | This is boolean option for enable or disable wait for finish of the job function. |
| freaze | This option disaable process event of waiting of results. |
- Returns
- true if the job function started correctly. If the await option is true then this method return result of job function.
Definition at line 78 of file async.cpp.
◆ waitFor() [1/2]
| bool QH::Async::waitFor |
( |
bool * | condition, |
|
|
int | timeout = WAIT_TIME, |
|
|
bool | freaze = true ) const |
|
protected |
waitFor This is base wait function.
- Parameters
-
| condition | This is pointer to awaiting boolean variable. |
| timeout | This is maximum time for wait. By default this value equals WAIT_TIME it is 30000 msec. |
| freaze | This frease current thread for waiting results of another thread. If you set this option to false then will be invoked process event method. |
- Returns
- true if condition is true.
Definition at line 67 of file async.cpp.
◆ waitFor() [2/2]
| bool QH::Async::waitFor |
( |
const Job & | condition, |
|
|
int | timeout = WAIT_TIME, |
|
|
bool | freaze = true ) const |
|
protected |
waitFor This is base wait function.
- Parameters
-
| condition | This is lambda method with condition results. |
| timeout | This is maximum time for wait. By default this value equals WAIT_TIME it is 30000 msec. |
| freaze | This frease current thread for waiting results of another thread. If you set this option to false then will be invoked process event method. |
- Returns
- true if condition is true.
Definition at line 118 of file async.cpp.
The documentation for this class was generated from the following files: