aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2020-03-10 15:18:51 -0700
committerMike Frysinger <vapier@chromium.org>2020-03-10 22:49:56 +0000
commit3f6f16b059f6f3f3e23a1f0476c04c3dc667fbbb (patch)
treedc0012438aa5888a1ccb2688dbcd139581b48097 /src
parentRevert "Add new dwarf 5 enums, plus some dwarf4 enums." (diff)
downloadbreakpad-3f6f16b059f6f3f3e23a1f0476c04c3dc667fbbb.tar.xz
Use sched_yield instead of pthread_yield
pthread_yield is not a standard POSIX function, and is not available in musl libc. The man page says to "Use the standardized sched_yield(2) instead"[0]. On glibc, pthread_yield is exactly equivalent to sched_yield[1]. On bionic, pthread_yield is also not available, so on Android, the tests define a wrapper that just calls sched_yield. This wrapper is no longer necessary if we just use sched_yield in the first place. [0] http://man7.org/linux/man-pages/man3/pthread_yield.3.html [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_yield.c Bug: google-breakpad:631 Change-Id: Ie4c6be8c17cdc2f5396a7fe972fa51a97573b049 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2097340 Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/common/android/testing/pthread_fixes.h5
-rw-r--r--src/common/linux/tests/crash_generator.cc3
2 files changed, 2 insertions, 6 deletions
diff --git a/src/common/android/testing/pthread_fixes.h b/src/common/android/testing/pthread_fixes.h
index 15c6309e..20c12084 100644
--- a/src/common/android/testing/pthread_fixes.h
+++ b/src/common/android/testing/pthread_fixes.h
@@ -89,11 +89,6 @@ int pthread_barrier_destroy(pthread_barrier_t *barrier) {
#endif // defined(PTHREAD_BARRIER_SERIAL_THREAD)
-int pthread_yield(void) {
- sched_yield();
- return 0;
-}
-
} // namespace
#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_TESTING_PTHREAD_FIXES_H
diff --git a/src/common/linux/tests/crash_generator.cc b/src/common/linux/tests/crash_generator.cc
index 36319676..6896a688 100644
--- a/src/common/linux/tests/crash_generator.cc
+++ b/src/common/linux/tests/crash_generator.cc
@@ -33,6 +33,7 @@
#include "common/linux/tests/crash_generator.h"
#include <pthread.h>
+#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <sys/mman.h>
@@ -88,7 +89,7 @@ void *thread_function(void *data) {
exit(1);
}
while (true) {
- pthread_yield();
+ sched_yield();
}
}