libfilezilla
Public Member Functions | Friends | List of all members
thread_pool Class Referencefinal

A dumb thread-pool for asynchronous tasks. More...

#include <thread_pool.hpp>

Public Member Functions

 thread_pool (thread_pool const &)=delete
 
thread_pooloperator= (thread_pool const &)=delete
 
async_task spawn (std::function< void()> const &f)
 Spawns a new asynchronous task.
 
async_task spawn (std::function< void()> &&f)
 

Friends

class async_task
 
class pooled_thread_impl
 

Detailed Description

A dumb thread-pool for asynchronous tasks.

If there are no idle threads, threads are created on-demand if spawning an asynchronous task. Once an asynchronous task finishes, the corresponding thread is kept idle until the pool is destroyed.

Any number of tasks can be run concurrently.

Examples
aio.cpp, https.cpp, nonblocking_process.cpp, and raw_https.cpp.

The documentation for this class was generated from the following file: