Make sure GetLastError on a PlatformThread return an error that is relevant to the thread.

BUG=none

Review-Url: https://codereview.webrtc.org/2541003002
Cr-Commit-Position: refs/heads/master@{#15328}
This commit is contained in:
perkj 2016-11-30 04:53:08 -08:00 committed by Commit bot
parent b49fc142e3
commit 6a2e20ad14

View File

@ -119,6 +119,11 @@ PlatformThread::~PlatformThread() {
#if defined(WEBRTC_WIN)
DWORD WINAPI PlatformThread::StartThread(void* param) {
// The GetLastError() function only returns valid results when it is called
// after a Win32 API function that returns a "failed" result. A crash dump
// contains the result from GetLastError() and to make sure it does not
// falsely report a Windows error we call SetLastError here.
::SetLastError(ERROR_SUCCESS);
static_cast<PlatformThread*>(param)->Run();
return 0;
}