Shaka Packager SDK
|
#include <thread_pool.h>
Public Types | |
typedef std::function< void()> | Task |
Public Member Functions | |
void | PostTask (const Task &task) |
Static Public Attributes | |
static ThreadPool | instance |
A simple thread pool. We used to get this from Chromium base::, but there is no replacement in the C++ standard library nor in absl. (As of June 2022.) The pool will grow when there are no threads available to handle a task, and it will shrink when a thread is idle for too long.
Definition at line 24 of file thread_pool.h.
void shaka::ThreadPool::PostTask | ( | const Task & | task | ) |
Find or spawn a worker thread to handle |task|.
task | A potentially long-running task to be handled by the pool. |
Definition at line 32 of file thread_pool.cc.