mirror of
https://github.com/golang/go
synced 2024-11-23 14:50:07 -07:00
22e4b8167f
Fix build error when CL=clang introduced by CL 10173. Change-Id: I8edf210787a9803280c0779ff710c7e634a820d6 Reviewed-on: https://go-review.googlesource.com/10341 Reviewed-by: Ian Lance Taylor <iant@golang.org>
37 lines
753 B
C
37 lines
753 B
C
// Copyright 2015 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
#include <signal.h>
|
|
#include <stdlib.h>
|
|
#include <pthread.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
extern void IntoGoAndBack();
|
|
|
|
int CheckBlocked() {
|
|
sigset_t mask;
|
|
sigprocmask(SIG_BLOCK, NULL, &mask);
|
|
return sigismember(&mask, SIGIO);
|
|
}
|
|
|
|
static void* sigthreadfunc(void* unused) {
|
|
sigset_t mask;
|
|
sigemptyset(&mask);
|
|
sigaddset(&mask, SIGIO);
|
|
sigprocmask(SIG_BLOCK, &mask, NULL);
|
|
IntoGoAndBack();
|
|
return NULL;
|
|
}
|
|
|
|
int RunSigThread() {
|
|
pthread_t thread;
|
|
int r;
|
|
|
|
r = pthread_create(&thread, NULL, &sigthreadfunc, NULL);
|
|
if (r != 0)
|
|
return r;
|
|
return pthread_join(thread, NULL);
|
|
}
|