/* Build up a pthread-like API using underlying Windows API. Have only static *methodssoastonotconflictwithapotentiallylinkedinpthread-win32 *library. *Asmostfunctionshereareusedwithoutcheckingreturnvalues,
* only implement return values as necessary. */
/* use light weight mutex/condition variable API for Windows Vista and later */ typedef SRWLOCK pthread_mutex_t; typedef CONDITION_VARIABLE pthread_cond_t;
// Although SetThreadDescription lives in kernel32.dll, on Windows Server 2016, // Windows 10 LTSB 2016 and Windows 10 version 1607, it was only available in // kernelbase.dll. So, load it from there for maximum coverage.
HMODULE kernelbase = GetModuleHandleW(L"kernelbase.dll"); if (!kernelbase) return AVERROR(ENOSYS);
SetThreadDescriptionFn pSetThreadDescription =
(SetThreadDescriptionFn)GetProcAddress(kernelbase, "SetThreadDescription"); if (!pSetThreadDescription) return AVERROR(ENOSYS);
wchar_t *wname; if (utf8towchar(name, &wname) < 0) return AVERROR(ENOMEM);
HRESULT hr = pSetThreadDescription(GetCurrentThread(), wname);
av_free(wname); return SUCCEEDED(hr) ? 0 : AVERROR(EINVAL); #else // UWP is not supported because we cannot use LoadLibrary/GetProcAddress to // detect the availability of the SetThreadDescription API. There is a small // gap in Windows builds 1507-1607 where it was not available. UWP allows // querying the availability of APIs with QueryOptionalDelayLoadedAPI, but it // requires /DELAYLOAD:kernel32.dll during linking, and we cannot enforce that. return AVERROR(ENOSYS); #endif
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.