about summary refs log tree commit diff
path: root/src/thread/synccall.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/synccall.c')
-rw-r--r--src/thread/synccall.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/thread/synccall.c b/src/thread/synccall.c
index a21578dc..c4149904 100644
--- a/src/thread/synccall.c
+++ b/src/thread/synccall.c
@@ -1,5 +1,6 @@
 #include "pthread_impl.h"
 #include <semaphore.h>
+#include <unistd.h>
 
 static struct chain {
 	struct chain *next;
@@ -13,12 +14,11 @@ static sem_t chainlock, chaindone;
 static void handler(int sig, siginfo_t *si, void *ctx)
 {
 	struct chain ch;
-	pthread_t self = __pthread_self();
 	int old_errno = errno;
 
 	if (chainlen == libc.threads_minus_1) return;
 
-	sigqueue(self->pid, SIGSYNCCALL, (union sigval){0});
+	sigqueue(getpid(), SIGSYNCCALL, (union sigval){0});
 
 	sem_init(&ch.sem, 0, 0);
 	sem_init(&ch.sem2, 0, 0);
@@ -39,7 +39,6 @@ static void handler(int sig, siginfo_t *si, void *ctx)
 
 void __synccall(void (*func)(void *), void *ctx)
 {
-	pthread_t self;
 	struct sigaction sa;
 	struct chain *next;
 	sigset_t oldmask;
@@ -65,8 +64,7 @@ void __synccall(void (*func)(void *), void *ctx)
 	sigfillset(&sa.sa_mask);
 	__libc_sigaction(SIGSYNCCALL, &sa, 0);
 
-	self = __pthread_self();
-	sigqueue(self->pid, SIGSYNCCALL, (union sigval){0});
+	sigqueue(getpid(), SIGSYNCCALL, (union sigval){0});
 	while (sem_wait(&chaindone));
 
 	sa.sa_flags = 0;