The Pedigree Project 0.1
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
RequestQueue::PreallocatedRequest Class Reference

#include <RequestQueue.h>

+ Collaboration diagram for RequestQueue::PreallocatedRequest:

Public Types

using ReleaseCallback = void(*)(void *)
 

Public Member Functions

 PreallocatedRequest (ReleaseCallback releaseCallback, void *releaseContext)
 
bool isAvailable () const
 

Private Types

enum  State { Idle , Claimed , Published , Releasing }
 

Private Member Functions

 NOT_COPYABLE_OR_ASSIGNABLE (PreallocatedRequest)
 

Private Attributes

Request m_Request
 
Atomic< size_t > m_State
 
Atomic< size_t > m_ReleaseDepth
 
ReleaseCallback m_ReleaseCallback
 
void * m_ReleaseContext
 

Friends

class RequestQueue
 

Detailed Description

Single preallocated publication slot for allocation-free producers.

Use one token per logical source. Republishing the same token coalesces work until the queued request has executed or been cancelled.

The owner must keep this object alive until isAvailable() is true. A successful publication transfers payload ownership to the queue; every rejection leaves ownership with the caller. An optional release callback runs after execution or cancellation, outside the request-list and waiter guard. The token remains unavailable until it returns. Its release callback is a callback boundary: lifecycle and ordinary publication calls on this queue are rejected before they can block or allocate. The explicit Releasing-token handoff below remains the one allocation-free way to preserve an already-observed follow-up. The callback can run on the queue worker, a teardown thread, or inline when threading is disabled. It must be bounded and nonblocking, and must not enter queue lifecycle operations or destroy the queue or token.

Definition at line 224 of file RequestQueue.h.

Member Typedef Documentation

◆ ReleaseCallback

using RequestQueue::PreallocatedRequest::ReleaseCallback = void (*)(void*)

Definition at line 226 of file RequestQueue.h.

Member Enumeration Documentation

◆ State

enum RequestQueue::PreallocatedRequest::State
private

Definition at line 238 of file RequestQueue.h.

Constructor & Destructor Documentation

◆ PreallocatedRequest() [1/2]

RequestQueue::PreallocatedRequest::PreallocatedRequest ( )

Definition at line 177 of file RequestQueue.cc.

◆ PreallocatedRequest() [2/2]

RequestQueue::PreallocatedRequest::PreallocatedRequest ( ReleaseCallback  releaseCallback,
void *  releaseContext 
)

Definition at line 179 of file RequestQueue.cc.

◆ ~PreallocatedRequest()

RequestQueue::PreallocatedRequest::~PreallocatedRequest ( )

Definition at line 187 of file RequestQueue.cc.

Member Function Documentation

◆ isAvailable()

bool RequestQueue::PreallocatedRequest::isAvailable ( ) const

Definition at line 193 of file RequestQueue.cc.

Friends And Related Symbol Documentation

◆ RequestQueue

friend class RequestQueue
friend

Definition at line 235 of file RequestQueue.h.

Member Data Documentation

◆ m_ReleaseCallback

ReleaseCallback RequestQueue::PreallocatedRequest::m_ReleaseCallback
private

Definition at line 248 of file RequestQueue.h.

◆ m_ReleaseContext

void* RequestQueue::PreallocatedRequest::m_ReleaseContext
private

Definition at line 249 of file RequestQueue.h.

◆ m_ReleaseDepth

Atomic<size_t> RequestQueue::PreallocatedRequest::m_ReleaseDepth
private

Definition at line 247 of file RequestQueue.h.

◆ m_Request

Request RequestQueue::PreallocatedRequest::m_Request
private

Definition at line 245 of file RequestQueue.h.

◆ m_State

Atomic<size_t> RequestQueue::PreallocatedRequest::m_State
private

Definition at line 246 of file RequestQueue.h.


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