summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2022-09-29 11:00:57 -0700
committer Colin Cross <ccross@android.com> 2022-09-29 22:02:22 +0000
commit532c121e6b1ef3f8a49b1b2c1c6e37626b8cc13f (patch)
tree4f52cebf1dc2fd13f363f47158947c0481a83e5e
parent57ff705fa56e66ceab13ad1ab534ff708dafad62 (diff)
Use sigqueue instead of pthread_sigqueue
pthread_sigqueue is a nonstandard extension that is not present in musl libc. art_sigchain_test is single threaded, so there is no need to specifically queue the signal to the current thread, use sigqueue instead. Bug: 190084016 Test: out/host/linux-x86/nativetest64/art_sigchain_tests/art_sigchain_tests Change-Id: Ie2c975736b99fd535f1000969f94859f25ae6de7
-rw-r--r--sigchainlib/sigchain_test.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sigchainlib/sigchain_test.cc b/sigchainlib/sigchain_test.cc
index d879f5ac85..6af38becfa 100644
--- a/sigchainlib/sigchain_test.cc
+++ b/sigchainlib/sigchain_test.cc
@@ -75,13 +75,17 @@ class SigchainTest : public ::testing::Test {
void RaiseHandled() {
sigval value;
value.sival_ptr = &value;
- pthread_sigqueue(pthread_self(), SIGSEGV, value);
+ // pthread_sigqueue would guarantee the signal is delivered to this
+ // thread, but it is a nonstandard extension and does not exist in
+ // musl. Gtest is single threaded, and these tests don't create any
+ // threads, so sigqueue can be used and will deliver to this thread.
+ sigqueue(getpid(), SIGSEGV, value);
}
void RaiseUnhandled() {
sigval value;
value.sival_ptr = nullptr;
- pthread_sigqueue(pthread_self(), SIGSEGV, value);
+ sigqueue(getpid(), SIGSEGV, value);
}
};