From f659749e403d42cc51ef9e6cc847acb988066f97 Mon Sep 17 00:00:00 2001 From: Jakob Progsch Date: Wed, 22 May 2013 12:02:29 +0200 Subject: [PATCH] basic usage in readme --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bee9415..be3d25a 100644 --- a/README.md +++ b/README.md @@ -3,5 +3,15 @@ ThreadPool A simple C++11 Thread Pool implementation. -The "legacy" directory contains a version that does not use std::future -but a custom Result type that has essentially the same functionalty. +Basic usage: +```c++ +// create thread pool with 4 worker threads +ThreadPool pool(4); + +// enqueue and store future +auto result = pool.enqueue([](int answer) { return answer; }, 42); + +// get result from future +std::cout << result.get() << std::endl; + +```