The task records of every thread that is neither a worker nor an adopted thread: at most maxExternalTasks live records, shared by all of them and used only while the caller holds the guard mutex, the global queue's.
More...
#include "donner/base/tasks/TaskRecord.h"
|
| | ExternalRecordPool (std::mutex &guard, std::size_t maxLiveRecords) |
|
| ExternalRecordPool (const ExternalRecordPool &)=delete |
|
ExternalRecordPool & | operator= (const ExternalRecordPool &)=delete |
|
| ~ExternalRecordPool ()=default |
| | Fails a release assertion if any record is still live.
|
| TaskRecord * | tryAllocate (const std::unique_lock< std::mutex > &held) |
| | Allocates a record.
|
| void | release (TaskRecord *record, const std::unique_lock< std::mutex > &held) |
| | Returns a record.
|
| std::size_t | liveCount (const std::unique_lock< std::mutex > &held) const |
| | Records allocated and not yet returned.
|
|
std::size_t | maxLiveRecords () const |
| | The bound on live records.
|
The task records of every thread that is neither a worker nor an adopted thread: at most maxExternalTasks live records, shared by all of them and used only while the caller holds the guard mutex, the global queue's.
Each call takes the caller's lock as proof and fails a release assertion if it does not hold the guard.
◆ ExternalRecordPool()
| donner::tasks::ExternalRecordPool::ExternalRecordPool |
( |
std::mutex & | guard, |
|
|
std::size_t | maxLiveRecords ) |
|
inline |
- Parameters
-
| guard | The mutex every call must hold. |
| maxLiveRecords | The bound on live records, above zero. |
◆ liveCount()
| std::size_t donner::tasks::ExternalRecordPool::liveCount |
( |
const std::unique_lock< std::mutex > & | held | ) |
const |
|
inlinenodiscard |
Records allocated and not yet returned.
- Parameters
-
| held | A lock holding the guard mutex. |
◆ release()
| void donner::tasks::ExternalRecordPool::release |
( |
TaskRecord * | record, |
|
|
const std::unique_lock< std::mutex > & | held ) |
|
inline |
Returns a record.
- Parameters
-
| record | A record of this pool holding no closure. |
| held | A lock holding the guard mutex. |
◆ tryAllocate()
| TaskRecord * donner::tasks::ExternalRecordPool::tryAllocate |
( |
const std::unique_lock< std::mutex > & | held | ) |
|
|
inlinenodiscard |
Allocates a record.
- Parameters
-
| held | A lock holding the guard mutex. |
- Returns
- The record, or null when the bound is reached, in which case the caller runs the task inline.
The documentation for this class was generated from the following file: