Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
SC::FiberJobScheduler Struct Reference

Fixed-capacity scheduler for stackless run-to-completion jobs. More...

#include <Fibers.h>

Public Member Functions

 FiberJobScheduler (const FiberJobScheduler &)=delete
 
FiberJobScheduleroperator= (const FiberJobScheduler &)=delete
 
Result create (Span< FiberJob * > readyStorage)
 
Result close ()
 
Result createWorkerDeques (FiberAllocator &allocator, Span< FiberJobWorker > workers, size_t capacityPerWorker)
 
void releaseWorkerDeques (Span< FiberJobWorker > workers)
 
Result spawn (FiberJob &job, FiberJob::Procedure procedure)
 
Result spawn (FiberJob &job, FiberJob::Procedure procedure, FiberCancellationToken token)
 
Result spawn (Span< FiberJob > jobs, FiberJob::Procedure procedure)
 Transactionally publishes distinct contiguous records to the current worker or bounded external queue.
 
Result spawn (Span< FiberJob > jobs, FiberJob::Procedure procedure, FiberCancellationToken token)
 
Result runOne (bool &outRanJob)
 
Result runOne (FiberJobWorker &worker, Span< FiberJobWorker > workerGroup, bool &outRanJob)
 
Result run ()
 
Result run (FiberJobWorker &worker, Span< FiberJobWorker > workerGroup)
 
Result shutdown ()
 
Result requestCancel (FiberJob &job)
 
Result requestCancel (FiberCancellationTokenSource &tokenSource)
 
Result requestCancelAll ()
 
bool isOpen () const
 
bool hasReadyJobs () const
 Never reports false while ready work transfers from the external queue to a worker.
 
bool hasActiveJobs () const
 Never reports false while active work transfers from the external queue to a worker.
 
size_t capacity () const
 
size_t readyJobCount () const
 Returns the exact stable count. A concurrent batch ownership transfer may conservatively overcount.
 
size_t activeJobCount () const
 Returns the exact stable count. A concurrent batch ownership transfer may conservatively overcount.
 
FiberJobcurrentJob ()
 
void workerDiagnostics (const FiberJobWorker &worker, FiberJobWorkerDiagnostics &outDiagnostics) const
 Diagnostics remain available after a worker pool joins and reset when its deque is configured again.
 

Friends

struct FiberJobContext
 
struct FiberJob
 
struct FiberJobWorkerPool
 

Detailed Description

Fixed-capacity scheduler for stackless run-to-completion jobs.

Plain run calls are single-thread-driven. External spawn and worker run calls may overlap while a FiberJobWorkerPool or caller-managed FiberJobWorker threads own execution.

Member Function Documentation

◆ activeJobCount()

size_t SC::FiberJobScheduler::activeJobCount ( ) const
nodiscard

Returns the exact stable count. A concurrent batch ownership transfer may conservatively overcount.

◆ hasActiveJobs()

bool SC::FiberJobScheduler::hasActiveJobs ( ) const
nodiscard

Never reports false while active work transfers from the external queue to a worker.

◆ hasReadyJobs()

bool SC::FiberJobScheduler::hasReadyJobs ( ) const
nodiscard

Never reports false while ready work transfers from the external queue to a worker.

◆ readyJobCount()

size_t SC::FiberJobScheduler::readyJobCount ( ) const
nodiscard

Returns the exact stable count. A concurrent batch ownership transfer may conservatively overcount.

◆ spawn()

Result SC::FiberJobScheduler::spawn ( Span< FiberJob > jobs,
FiberJob::Procedure procedure )

Transactionally publishes distinct contiguous records to the current worker or bounded external queue.

◆ workerDiagnostics()

void SC::FiberJobScheduler::workerDiagnostics ( const FiberJobWorker & worker,
FiberJobWorkerDiagnostics & outDiagnostics ) const

Diagnostics remain available after a worker pool joins and reset when its deque is configured again.

The caller must not read diagnostics while that worker can execute jobs.


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