Shaka Packager SDK
Public Types | Public Member Functions | Static Public Attributes | List of all members
shaka::ThreadPool Class Reference

#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
 

Detailed Description

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.

Member Function Documentation

◆ PostTask()

void shaka::ThreadPool::PostTask ( const Task &  task)

Find or spawn a worker thread to handle |task|.

Parameters
taskA potentially long-running task to be handled by the pool.

Definition at line 32 of file thread_pool.cc.


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