MCPcopy Create free account
hub / github.com/NVIDIA-RTX/Donut / ThreadProc

Method ThreadProc

src/engine/ThreadPool.cpp:97–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97void ThreadPool::ThreadProc()
98{
99 while(!m_terminate.load())
100 {
101 std::shared_ptr<ThreadPoolTask> task;
102
103 // Wait until a task is available or termination is requested
104 {
105 std::unique_lock<std::mutex> lock(m_mutex);
106 m_forward.wait(lock, [this] { return !m_tasks.empty() || m_terminate.load(); });
107
108 if (!m_tasks.empty())
109 {
110 task = std::move(m_tasks.front());
111 m_tasks.pop();
112 }
113 }
114
115 if (task)
116 {
117 try
118 {
119 task->Run();
120 }
121 catch(...)
122 {
123 // Ignore task exceptions
124 }
125 --m_pendingTasks;
126 }
127 }
128}
129
130}

Callers 1

StaticThreadProcMethod · 0.95

Calls 2

RunMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected