dispenso
A library for task parallelism
 
Loading...
Searching...
No Matches
thread_pool.h File Reference
#include <atomic>
#include <cassert>
#include <condition_variable>
#include <cstdlib>
#include <deque>
#include <mutex>
#include <thread>
#include <concurrentqueue.h>
#include <dispenso/detail/epoch_waiter.h>
#include <dispenso/detail/per_thread_info.h>
#include <dispenso/once_function.h>
#include <dispenso/platform.h>
#include <dispenso/tsan_annotations.h>

Go to the source code of this file.

Classes

struct  dispenso::ForceQueuingTag
 
class  dispenso::ThreadPool
 

Macros

#define DISPENSO_WAKEUP_ENABLE   0
 
#define DISPENSO_POLL_PERIOD_US   200
 

Functions

ThreadPooldispenso::globalThreadPool ()
 
void dispenso::resizeGlobalThreadPool (size_t numThreads)
 

Variables

constexpr uint32_t dispenso::kDefaultSleepLenUs = DISPENSO_POLL_PERIOD_US
 
constexpr bool dispenso::kDefaultWakeupEnable = DISPENSO_WAKEUP_ENABLE
 

Detailed Description

A file providing ThreadPool. This is the heart of dispenso. All other scheduling paradigms, including TaskSets, Futures, pipelines, and parallel loops, are built on top of ThreadPool.

Definition in file thread_pool.h.

Macro Definition Documentation

◆ DISPENSO_POLL_PERIOD_US

#define DISPENSO_POLL_PERIOD_US   200

Definition at line 50 of file thread_pool.h.

◆ DISPENSO_WAKEUP_ENABLE

#define DISPENSO_WAKEUP_ENABLE   0

Definition at line 41 of file thread_pool.h.

Function Documentation

◆ globalThreadPool()

DISPENSO_DLL_ACCESS ThreadPool & dispenso::globalThreadPool ( )

Get access to the global thread pool.

Returns
the global thread pool

Definition at line 223 of file thread_pool.cpp.

◆ resizeGlobalThreadPool()

DISPENSO_DLL_ACCESS void dispenso::resizeGlobalThreadPool ( size_t  numThreads)

Change the number of threads backing the global thread pool.

Parameters
numThreadsThe number of threads to back the global thread pool.

Definition at line 231 of file thread_pool.cpp.

Variable Documentation

◆ kDefaultSleepLenUs

constexpr uint32_t dispenso::kDefaultSleepLenUs = DISPENSO_POLL_PERIOD_US
constexpr

Definition at line 57 of file thread_pool.h.

◆ kDefaultWakeupEnable

constexpr bool dispenso::kDefaultWakeupEnable = DISPENSO_WAKEUP_ENABLE
constexpr

Definition at line 59 of file thread_pool.h.