Skip to content

Commit f659749

Browse files
committed
basic usage in readme
1 parent 7e8ad09 commit f659749

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,15 @@ ThreadPool
33

44
A simple C++11 Thread Pool implementation.
55

6-
The "legacy" directory contains a version that does not use std::future
7-
but a custom Result<T> type that has essentially the same functionalty.
6+
Basic usage:
7+
```c++
8+
// create thread pool with 4 worker threads
9+
ThreadPool pool(4);
10+
11+
// enqueue and store future
12+
auto result = pool.enqueue([](int answer) { return answer; }, 42);
13+
14+
// get result from future
15+
std::cout << result.get() << std::endl;
16+
17+
```

0 commit comments

Comments
 (0)