Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Commit 08e916f

Browse files
committed
Add qpm.json
1 parent f8157cb commit 08e916f

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,28 @@ QCOMPARE(d.future().isCanceled(), false);
124124
125125
```
126126

127+
Read a file. If timeout, cancel it.
128+
129+
```c++
130+
131+
auto timeout = observe(timer, &QTimer::timeout).future();
132+
133+
auto defer = deferred<QString>();
134+
135+
defer.complete(QtConcurrent::run(readFileworker, fileName));
136+
defer.cancel(timeout);
137+
138+
return defer.future();
139+
```
140+
127141
More examples are available at : [asyncfuture/example.cpp at master · benlau/asyncfuture](https://github.com/benlau/asyncfuture/blob/master/tests/asyncfutureunittests/example.cpp)
128142

129143
Installation
130144
=============
131145

132146
AsyncFuture is a single header library. You could just download the `asyncfuture.h` in your source tree or install it via qpm
133147

134-
qpm install xxxx (coming soon)
148+
qpm install async.future.pri (coming soon)
135149

136150
or
137151

qpm.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "async.future.pri",
3+
"description": "",
4+
"author": {
5+
"name": "Ben Lau",
6+
"email": "[email protected]"
7+
},
8+
"repository": {
9+
"type": "GITHUB",
10+
"url": "[email protected]:benlau/asyncfuture.git"
11+
},
12+
"version": {
13+
"label": "0.0.1",
14+
"revision": "",
15+
"fingerprint": ""
16+
},
17+
"dependencies": [
18+
],
19+
"license": "APACHE_2_0",
20+
"pri_filename": "asyncfuture.pri",
21+
"webpage": ""
22+
}

0 commit comments

Comments
 (0)