/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/Foundation/Threading/Implementation/ThreadWithDispatcher.cpp
32 строки
802 B
Ingrater
Clang-format fixes and update to 18.1.1 (#1234)
10 мар 2024, 15:51
Не верифицирован
10 мар 2024, 15:51
2f16acf
Код
Авторство
О чём код?
#include <Foundation/FoundationPCH.h> #include <Foundation/Profiling/Profiling.h> #include <Foundation/Threading/ThreadWithDispatcher.h> ezThreadWithDispatcher::ezThreadWithDispatcher(const char* szName /*= "ezThreadWithDispatcher"*/, ezUInt32 uiStackSize /*= 128 * 1024*/) : ezThread(szName, uiStackSize) { } ezThreadWithDispatcher::~ezThreadWithDispatcher() = default; void ezThreadWithDispatcher::Dispatch(DispatchFunction&& delegate) { EZ_LOCK(m_QueueMutex); m_ActiveQueue.PushBack(std::move(delegate)); } void ezThreadWithDispatcher::DispatchQueue() { { EZ_LOCK(m_QueueMutex); std::swap(m_ActiveQueue, m_CurrentlyBeingDispatchedQueue); } for (const auto& pDelegate : m_CurrentlyBeingDispatchedQueue) { pDelegate(); } m_CurrentlyBeingDispatchedQueue.Clear(); }