blob: 4dec0072f348e9763800d94c4b00bcc5a7df87c5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
--- third_party/webrtc/base/platform_thread.cc.orig 2016-05-11 19:04:03 UTC
+++ third_party/webrtc/base/platform_thread.cc
@@ -12,11 +12,18 @@
#include "webrtc/base/checks.h"
-#if defined(WEBRTC_LINUX)
+#if defined(WEBRTC_LINUX) && !defined(__FreeBSD__)
#include <sys/prctl.h>
#include <sys/syscall.h>
#endif
+#if defined(WEBRTC_BSD)
+#include <pthread.h>
+#include <pthread_np.h>
+#include <sys/syscall.h>
+#include <sys/thr.h>
+#endif
+
namespace rtc {
PlatformThreadId CurrentThreadId() {
@@ -26,6 +33,8 @@ PlatformThreadId CurrentThreadId() {
#elif defined(WEBRTC_POSIX)
#if defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
ret = pthread_mach_thread_np(pthread_self());
+#elif defined(WEBRTC_BSD)
+ ret = static_cast<int>(pthread_getthreadid_np());
#elif defined(WEBRTC_LINUX)
ret = syscall(__NR_gettid);
#elif defined(WEBRTC_ANDROID)
@@ -69,7 +78,9 @@ void SetCurrentThreadName(const char* na
reinterpret_cast<ULONG_PTR*>(&threadname_info));
} __except (EXCEPTION_EXECUTE_HANDLER) {
}
-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
+#elif defined(WEBRTC_BSD)
+ pthread_set_name_np(pthread_self(), name);
+#elif (defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)) && !defined(WEBRTC_BSD)
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name));
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
pthread_setname_np(name);
|