载入中...
搜索中...
未找到
eve::thread::JobSystemThreadPool类 参考final

Default JobSystem backend: a dependency-aware scheduler over the existing ThreadPool worker pool. 更多...

#include <JobSystemThreadPool.h>

类 eve::thread::JobSystemThreadPool 继承关系图:
eve::thread::JobSystem

struct  State
 

Public 成员函数

 JobSystemThreadPool (int workerCount)
 
 ~JobSystemThreadPool () override
 
 JobSystemThreadPool (const JobSystemThreadPool &)=delete
 
JobSystemThreadPooloperator= (const JobSystemThreadPool &)=delete
 
int getWorkerCount () const override
 Number of scheduler worker threads.
 
bool isRunning () const override
 Whether the system is still accepting new jobs.
 
int getPendingCount () const override
 Number of ready jobs waiting for a worker (approximate).
 
int getOutstandingCount () const override
 Number of scheduled jobs that have not finished (approximate).
 
Jobsubmit (JobFunc body) override
 Create a job and schedule it immediately.
 
JobcreateJob (JobFunc body) override
 Create a paused job (dependencies can be wired, then schedule()).
 
void schedule (Job *job) override
 Kick a paused job so it can run.
 
JobparallelFor (int first, int last, ParallelForBody body, int chunk=1) override
 Run body over [first, last) in parallel.
 
TaskGroupcreateTaskGroup () override
 Create a fork/join task group.
 
JobsubmitFrame (JobFunc body) override
 Create a frame-scoped job and schedule it immediately.
 
JobcreateFrameJob (JobFunc body) override
 Create a paused frame-scoped job.
 
JobparallelForFrame (int first, int last, ParallelForBody body, int chunk=1) override
 Frame-scoped parallel_for; see parallelFor().
 
TaskGroupcreateFrameTaskGroup () override
 Create a fork/join task group whose children are frame-scoped.
 
void beginFrame () override
 Start a new frame: join leftover frame jobs and recycle the arena.
 
void endFrame () override
 End the frame: join outstanding frame jobs and recycle the arena.
 
void waitAll () override
 Block until every scheduled job has finished.
 
void stop () override
 Stop accepting work and join workers. Idempotent.
 
- Public 成员函数 继承自 eve::thread::JobSystem
virtual ~JobSystem ()=default
 

详细描述

Default JobSystem backend: a dependency-aware scheduler over the existing ThreadPool worker pool.

The ThreadPool keeps its FIFO + CV worker model unchanged; this class uses it purely as the worker-thread provider. Job scheduling (dependencies, ready queue, fork/join help-execution, per-frame arena) lives here, so replacing the backend with TBB does not touch any engine code that uses JobSystem.

在文件 JobSystemThreadPool.h24 行定义.

构造及析构函数说明

◆ JobSystemThreadPool() [1/2]

eve::thread::JobSystemThreadPool::JobSystemThreadPool ( int  workerCount)
explicit

在文件 JobSystemThreadPool.cpp492 行定义.

引用了 state.

◆ ~JobSystemThreadPool()

eve::thread::JobSystemThreadPool::~JobSystemThreadPool ( )
override

在文件 JobSystemThreadPool.cpp522 行定义.

◆ JobSystemThreadPool() [2/2]

eve::thread::JobSystemThreadPool::JobSystemThreadPool ( const JobSystemThreadPool )
delete

成员函数说明

◆ beginFrame()

void eve::thread::JobSystemThreadPool::beginFrame ( )
overridevirtual

Start a new frame: join leftover frame jobs and recycle the arena.

All frame-scoped handles from the previous frame become invalid. Call once per frame before submitting frame jobs.

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp640 行定义.

◆ createFrameJob()

Job * eve::thread::JobSystemThreadPool::createFrameJob ( JobFunc  body)
overridevirtual

Create a paused frame-scoped job.

参数
bodyWork to run on a worker.
返回
Arena-allocated Job; do not delete, valid until next beginFrame().

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp623 行定义.

引用了 body.

◆ createFrameTaskGroup()

TaskGroup * eve::thread::JobSystemThreadPool::createFrameTaskGroup ( )
overridevirtual

Create a fork/join task group whose children are frame-scoped.

返回
Arena-allocated TaskGroup; do not delete, valid until next beginFrame().

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp632 行定义.

引用了 group , 以及 ptr.

◆ createJob()

Job * eve::thread::JobSystemThreadPool::createJob ( JobFunc  body)
overridevirtual

Create a paused job (dependencies can be wired, then schedule()).

参数
bodyWork to run on a worker; may be empty to create a pure join/dependency node that just gates downstream jobs.
返回
Heap-allocated Job; delete once finished.

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp584 行定义.

引用了 body.

◆ createTaskGroup()

TaskGroup * eve::thread::JobSystemThreadPool::createTaskGroup ( )
overridevirtual

Create a fork/join task group.

返回
Heap-allocated TaskGroup; delete once joined.

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp606 行定义.

◆ endFrame()

void eve::thread::JobSystemThreadPool::endFrame ( )
overridevirtual

End the frame: join outstanding frame jobs and recycle the arena.

Blocks until every frame-scoped job finished, so results are safe to consume (e.g. before swapping GPU buffers). Idempotent with beginFrame().

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp644 行定义.

◆ getOutstandingCount()

int eve::thread::JobSystemThreadPool::getOutstandingCount ( ) const
overridevirtual

Number of scheduled jobs that have not finished (approximate).

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp566 行定义.

◆ getPendingCount()

int eve::thread::JobSystemThreadPool::getPendingCount ( ) const
overridevirtual

Number of ready jobs waiting for a worker (approximate).

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp561 行定义.

◆ getWorkerCount()

int eve::thread::JobSystemThreadPool::getWorkerCount ( ) const
overridevirtual

Number of scheduler worker threads.

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp552 行定义.

◆ isRunning()

bool eve::thread::JobSystemThreadPool::isRunning ( ) const
overridevirtual

Whether the system is still accepting new jobs.

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp556 行定义.

◆ operator=()

JobSystemThreadPool & eve::thread::JobSystemThreadPool::operator= ( const JobSystemThreadPool )
delete

◆ parallelFor()

Job * eve::thread::JobSystemThreadPool::parallelFor ( int  first,
int  last,
ParallelForBody  body,
int  chunk = 1 
)
overridevirtual

Run body over [first, last) in parallel.

The range is statically split into ceil((last-first)/chunk) child jobs; the returned job represents the whole loop and finishes when every child is done. chunk <= 0 picks an automatic chunk targeting ~4 tasks per worker.

参数
firstFirst index (inclusive).
lastOne past the last index (exclusive).
bodyCalled on a worker for each subrange [first, last).
chunkSubrange size per child task (default 1).
返回
Heap-allocated loop Job; wait() on it joins the loop.

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp602 行定义.

引用了 body.

◆ parallelForFrame()

Job * eve::thread::JobSystemThreadPool::parallelForFrame ( int  first,
int  last,
ParallelForBody  body,
int  chunk = 1 
)
overridevirtual

Frame-scoped parallel_for; see parallelFor().

返回
Arena-allocated loop Job; do not delete.

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp628 行定义.

引用了 body.

◆ schedule()

void eve::thread::JobSystemThreadPool::schedule ( Job job)
overridevirtual

Kick a paused job so it can run.

A job with no pending dependencies becomes ready immediately; a job with dependencies runs when its last predecessor finishes. Throws when the system is stopped or the job was already scheduled.

参数
jobJob previously returned by createJob()/createFrameJob().

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp589 行定义.

引用了 impl.

◆ stop()

void eve::thread::JobSystemThreadPool::stop ( )
overridevirtual

Stop accepting work and join workers. Idempotent.

异常
eve::Exceptionwhen called from one of this system's workers.

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp668 行定义.

◆ submit()

Job * eve::thread::JobSystemThreadPool::submit ( JobFunc  body)
overridevirtual

Create a job and schedule it immediately.

参数
bodyWork to run on a worker; may be empty to create a pure join/dependency node that just gates downstream jobs.
返回
Heap-allocated Job; delete once finished.

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp571 行定义.

引用了 body.

◆ submitFrame()

Job * eve::thread::JobSystemThreadPool::submitFrame ( JobFunc  body)
overridevirtual

Create a frame-scoped job and schedule it immediately.

参数
bodyWork to run on a worker.
返回
Arena-allocated Job; do not delete, valid until next beginFrame().

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp610 行定义.

引用了 body.

◆ waitAll()

void eve::thread::JobSystemThreadPool::waitAll ( )
overridevirtual

Block until every scheduled job has finished.

异常
eve::Exceptionwhen called from one of this system's workers.

实现了 eve::thread::JobSystem.

在文件 JobSystemThreadPool.cpp648 行定义.

引用了 state.


该类的文档由以下文件生成: