Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::tasks::RecordStore Class Reference

The records one pool has created, its free list and its live count, used by one thread at a time: the owning creator for CreatorRecordPool, the holder of the guard mutex for ExternalRecordPool. More...

#include "donner/base/tasks/TaskRecord.h"

Public Member Functions

 RecordStore (std::size_t maxLiveRecords)
 RecordStore (const RecordStore &)=delete
RecordStore & operator= (const RecordStore &)=delete
 ~RecordStore ()
 Deletes every record. Every record must be back on the free list.
TaskRecord * allocate (const void *pool)
 Takes a record from the free list, or creates one while fewer than the bound exist.
void release (TaskRecord *record)
 Puts one record back on the free list. It must hold no closure.
std::size_t releaseList (TaskRecord *head)
 Puts a list of records, linked through their links and already poisoned, back on the free list.
bool hasFreeRecord () const
 Whether the free list holds a record.
std::size_t liveCount () const
 Records allocated and not yet back on the free list.
std::size_t createdCount () const
 Records created so far; never above maxLiveRecords.
std::size_t maxLiveRecords () const
 The bound on live records.

Detailed Description

The records one pool has created, its free list and its live count, used by one thread at a time: the owning creator for CreatorRecordPool, the holder of the guard mutex for ExternalRecordPool.

Constructor & Destructor Documentation

◆ RecordStore()

donner::tasks::RecordStore::RecordStore ( std::size_t maxLiveRecords)
inlineexplicit
Parameters
maxLiveRecordsThe most records the pool creates; a record is live from allocation until it is back on the free list.

Member Function Documentation

◆ allocate()

TaskRecord * donner::tasks::RecordStore::allocate ( const void * pool)
inlinenodiscard

Takes a record from the free list, or creates one while fewer than the bound exist.

Parameters
poolIdentity stored in the record.
Returns
The record, or null when the bound is reached and the free list is empty.

◆ releaseList()

std::size_t donner::tasks::RecordStore::releaseList ( TaskRecord * head)
inline

Puts a list of records, linked through their links and already poisoned, back on the free list.

Parameters
headFirst record of the list.
Returns
The number of records.

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