diff --git a/src/rtc_base/platform_thread_types.cc b/src/rtc_base/platform_thread_types.cc index 7ba874fb..ec41c6f8 100644 --- a/src/rtc_base/platform_thread_types.cc +++ b/src/rtc_base/platform_thread_types.cc @@ -28,6 +28,8 @@ typedef HRESULT(WINAPI* RTC_SetThreadDescription)(HANDLE hThread, #if defined(WEBRTC_FREEBSD) #include #include +#elif defined(WEBRTC_OPENBSD) +#include #endif namespace rtc { @@ -51,7 +53,7 @@ PlatformThreadId CurrentThreadId() { #elif defined(__EMSCRIPTEN__) return static_cast(pthread_self()); #else - // Default implementation for nacl and solaris. + // Default implementation for nacl, openbsd and solaris. return reinterpret_cast(pthread_self()); #endif #endif // defined(WEBRTC_POSIX) @@ -118,6 +120,8 @@ void SetCurrentThreadName(const char* name) { prctl(PR_SET_NAME, reinterpret_cast(name)); // NOLINT #elif defined(WEBRTC_FREEBSD) pthread_setname_np(pthread_self(), name); +#elif defined(WEBRTC_OPENBSD) + pthread_set_name_np(pthread_self(), name); #elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS) pthread_setname_np(name); #endif diff --git a/src/rtc_base/platform_thread_types.h b/src/rtc_base/platform_thread_types.h index 6b9101ee..1d7887ef 100644 --- a/src/rtc_base/platform_thread_types.h +++ b/src/rtc_base/platform_thread_types.h @@ -22,6 +22,8 @@ #elif defined(WEBRTC_FUCHSIA) #include #include +#elif defined(WEBRTC_OPENBSD) +#include #elif defined(WEBRTC_POSIX) #include #include @@ -38,6 +40,9 @@ typedef DWORD PlatformThreadRef; #elif defined(WEBRTC_FUCHSIA) typedef zx_handle_t PlatformThreadId; typedef zx_handle_t PlatformThreadRef; +#elif defined(WEBRTC_OPENBSD) +typedef uint64_t PlatformThreadId; +typedef pthread_t PlatformThreadRef; #elif defined(WEBRTC_POSIX) typedef pid_t PlatformThreadId; typedef pthread_t PlatformThreadRef;