|
Blender V5.0
|
#include <GPU_worker.hh>
Public Types | |
| enum class | ContextType { Main , PerThread } |
Public Member Functions | |
| GPUWorker (uint32_t threads_count, ContextType context_type, std::mutex &mutex, std::function< void *()> pop_work, std::function< void(void *)> do_work) | |
| ~GPUWorker () | |
| void | wake_up () |
Abstracts the creation and management of secondary threads with GPU contexts. Must be created from the main thread. Threads and their context remain alive until destruction.
Definition at line 24 of file GPU_worker.hh.
|
strong |
| Enumerator | |
|---|---|
| Main | Use the main GPU context on the worker threads. |
| PerThread | Use a different secondary GPU context for each worker thread. |
Definition at line 32 of file GPU_worker.hh.
| blender::gpu::GPUWorker::GPUWorker | ( | uint32_t | threads_count, |
| ContextType | context_type, | ||
| std::mutex & | mutex, | ||
| std::function< void *()> | pop_work, | ||
| std::function< void(void *)> | do_work ) |
| threads_count | Number of threads to span. |
| context_type | The type of context each thread uses. |
| mutex | Mutex used when trying to acquire the next work (and reused internally for termination). |
| pop_work | The callback function that will be called to acquire the next work, should return a void pointer. NOTE: The mutex is locked when this function is called. |
| do_work | The callback function that will be called for each acquired work (passed as a void pointer). NOTE: The mutex is unlocked when this function is called. |
Definition at line 9 of file gpu_worker.cc.
References i, mutex, PerThread, and UNUSED_VARS.
| blender::gpu::GPUWorker::~GPUWorker | ( | ) |
Definition at line 25 of file gpu_worker.cc.
References thread::join(), and lock.
|
inline |
Definition at line 59 of file GPU_worker.hh.