MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / EndWatcherThread

Method EndWatcherThread

ExplorerHooks/taskviewvisibilitymonitor.cpp:161–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161void TaskViewVisibilityMonitor::EndWatcherThread() noexcept
162{
163 // check if the thread is still alive
164 const DWORD waitResult = WaitForSingleObject(s_hThread.get(), 0);
165 if (waitResult == WAIT_TIMEOUT)
166 {
167 // if the DLL gets unloaded before the thread began
168 // executing, we still need to terminate it.
169 if (s_ThreadRunning)
170 {
171 const DWORD tid = GetThreadId(s_hThread.get());
172 FAIL_FAST_LAST_ERROR_IF(!tid);
173
174 FAIL_FAST_IF_WIN32_BOOL_FALSE(PostThreadMessage(tid, WM_QUIT, 0, 0));
175
176 const DWORD shutdownWaitResult = WaitForSingleObject(s_ThreadCleanupEvent.get(), INFINITE);
177 FAIL_FAST_LAST_ERROR_IF(shutdownWaitResult != WAIT_OBJECT_0);
178 }
179
180 // terminate it
181 FAIL_FAST_IF_WIN32_BOOL_FALSE(TerminateThread(s_hThread.get(), 0));
182 }
183 else
184 {
185 FAIL_FAST_LAST_ERROR_IF(waitResult != WAIT_OBJECT_0);
186 }
187}
188
189void TaskViewVisibilityMonitor::Install() noexcept
190{

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected