 |
libfilezilla
|
Go to the documentation of this file. 1 #ifndef LIBFILEZILLA_THREAD_POOL_HEADER
2 #define LIBFILEZILLA_THREAD_POOL_HEADER
19 class async_task_impl;
40 explicit operator bool()
const {
return impl_ !=
nullptr; }
48 async_task_impl* impl_{};
52 class pooled_thread_impl;
76 friend class pooled_thread_impl;
78 std::vector<pooled_thread_impl*> threads_;
79 std::vector<pooled_thread_impl*> idle_;
void detach()
Detach the running thread from the task. Once done, the thread adds itself back into the pool.
Lean replacement for std::(recursive_)mutex.
Definition: mutex.hpp:28
Handle for asynchronous tasks.
Definition: thread_pool.hpp:23
~async_task()
If task has not been detached, calls join.
void join()
Wait for the task to finish, adds the now idle thread back into the pool.
Sets some global macros and further includes string.hpp.
async_task spawn(std::function< void()> const &f)
Spawns a new asynchronous task.
A dumb thread-pool for asynchronous tasks.
Definition: thread_pool.hpp:63
The namespace used by libfilezilla.
Definition: apply.hpp:17
Thread synchronization primitives: mutex, scoped_lock and condition.