Shaka Packager SDK
Loading...
Searching...
No Matches
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 Typedef Documentation

◆ Task

typedef std::function<void()> shaka::ThreadPool::Task

Definition at line 26 of file thread_pool.h.

Constructor & Destructor Documentation

◆ ThreadPool()

shaka::ThreadPool::ThreadPool ( )

Definition at line 26 of file thread_pool.cc.

◆ ~ThreadPool()

shaka::ThreadPool::~ThreadPool ( )

Definition at line 28 of file thread_pool.cc.

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.

Member Data Documentation

◆ instance

ThreadPool shaka::ThreadPool::instance
static

Definition at line 35 of file thread_pool.h.


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