This is a draft implementation of proposal N3875 and the current draft proposal from the concurreny_ts.
Note: There may be some slight deviations from these proposal in the form of naming (submit vs. add) and argument order.
It includes the following classes and functions
class executor {
public:
virtual ~executor() {};
virtual void add(function<void()>) = 0;
virtual size_t num_uninitiated_task() = 0;
};
class scheduled_executor : public executor {
public:
virtual void add_at(function<void()>, chrono::steady_clock::time_point) = 0;
virtual void add_after(function<void()>, chrono::steady_clock::duration) = 0;
};
thread_pool
scheduled_thread_pool
inline_executor
task_per_thread_executor
serial_executor
loop_executor
[in progress]
Note: This function has the same signature as std::async from the concurreny_ts working draft.
template<typename F,typename... Args>
future< typename result_of<F(Args...)>::type > add(executor& ex, F&& fn, Args&&... args);
All classes have been implemented in the std::experimental
namespace as header only files.
These headers all reside in include/experimental
folder.
In order to use theses classes you can simply compile with
g++ --std=c++11 myfile.cpp -I path/to/this/projects/include -pthread
clang --std=c++11 myfile.cpp -I path/to/this/projects/include -pthread -lstdc++
There is a collection of basic examples/tests in the src
directory.
-
`g++ 4.6` (Won't work)
-
`g++ 4.7` (Good)
-
`g++ 4.8` (Good)
-
`clang 3.4` (Good)
- Create more rigorous tests.
- Abstract all queuing operations into a private sync_queue class.