diff options
author | Dan Vrátil <dvratil@redhat.com> | 2015-03-30 17:49:26 +0200 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2015-03-30 17:49:28 +0200 |
commit | 8f2fed8d2a1b23a8f318047b6592ad64b6ecbd22 (patch) | |
tree | 6f8d5ea2dc8695dfc6c3c641c2ef044ad5810bd8 /async/CMakeLists.txt | |
parent | 1d946c166cc7a4a2556e8bfaab7dc66695b555e1 (diff) | |
download | sink-8f2fed8d2a1b23a8f318047b6592ad64b6ecbd22.tar.gz sink-8f2fed8d2a1b23a8f318047b6592ad64b6ecbd22.zip |
Async: initial support for native chaining of KJobs
It is now possible use KJob-derived jobs with libasync without having to write
lambda wrappers.
auto job = Async::start<ReturnType, MyKJob, MyKJob::result, Args ...)
.then<ReturnType, OtherKJob, OtherKJob::result, PrevKJobReturnType>();
job.exec(arg1, arg2, ...);
The reason for this approach (instead of taking KJob* as an argument is that
we usually want the KJob ctor arguments to depend on result of previous job.
At least in case of Async::start() however it makes sense to support passing
KJob* as an argument (not yet implemented).
In future we should also support custom error handlers.
The KJob integration is build-time optional, but enabled by default (pass
-DWITH_KJOB=FALSE to CMake to disable).
Adds KCoreAddons dependency.
Diffstat (limited to 'async/CMakeLists.txt')
-rw-r--r-- | async/CMakeLists.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/async/CMakeLists.txt b/async/CMakeLists.txt index 19ac407..a6b53f8 100644 --- a/async/CMakeLists.txt +++ b/async/CMakeLists.txt | |||
@@ -1,2 +1,12 @@ | |||
1 | project(libasync) | ||
2 | |||
3 | option(WITH_KJOB "Enable native support for KJob in libasync API (enabled by default)" ON) | ||
4 | |||
5 | if (WITH_KJOB) | ||
6 | set(MINUMUM_FRAMEWORKS_VERSION "5.8.0") | ||
7 | find_package(KF5CoreAddons REQUIRED ${MINUMUM_FRAMEWORKS_VERSION}) | ||
8 | add_definitions(-DWITH_KJOB) | ||
9 | endif() | ||
10 | |||
1 | add_subdirectory(src) | 11 | add_subdirectory(src) |
2 | add_subdirectory(autotests) \ No newline at end of file | 12 | add_subdirectory(autotests) \ No newline at end of file |