Skip to content

Commit abd592b

Browse files
committed
misc/cgo/testsigfwd: delete unused code
This code was introduced in CL 17903 but has never executed. It's also fundamentally non-deterministic. Delete it. Simplification for #37486. Change-Id: I049564123fb4fba401154e2ea0fc429e552d4749 Reviewed-on: https://go-review.googlesource.com/c/go/+/431258 Reviewed-by: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Austin Clements <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 4456334 commit abd592b

File tree

1 file changed

+0
-52
lines changed

1 file changed

+0
-52
lines changed

misc/cgo/testsigfwd/main.go

-52
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ package main
77
import "fmt"
88

99
/*
10-
#cgo CFLAGS: -pthread
11-
#cgo LDFLAGS: -pthread
12-
1310
#include <signal.h>
1411
#include <stdlib.h>
1512
#include <stdio.h>
1613
#include <string.h>
17-
#include <pthread.h>
1814
1915
int *p;
2016
static void sigsegv() {
@@ -30,60 +26,12 @@ static void segvhandler(int signum) {
3026
}
3127
}
3228
33-
static volatile sig_atomic_t sigioSeen;
34-
35-
// Use up some stack space.
36-
static void recur(int i, char *p) {
37-
char a[1024];
38-
39-
*p = '\0';
40-
if (i > 0) {
41-
recur(i - 1, a);
42-
}
43-
}
44-
45-
static void iohandler(int signum) {
46-
char a[1024];
47-
48-
recur(4, a);
49-
sigioSeen = 1;
50-
}
51-
52-
static void* sigioThread(void* arg __attribute__ ((unused))) {
53-
raise(SIGIO);
54-
return NULL;
55-
}
56-
57-
static void sigioOnThread() {
58-
pthread_t tid;
59-
int i;
60-
61-
pthread_create(&tid, NULL, sigioThread, NULL);
62-
pthread_join(tid, NULL);
63-
64-
// Wait until the signal has been delivered.
65-
i = 0;
66-
while (!sigioSeen) {
67-
if (sched_yield() < 0) {
68-
perror("sched_yield");
69-
}
70-
i++;
71-
if (i > 10000) {
72-
fprintf(stderr, "looping too long waiting for signal\n");
73-
exit(EXIT_FAILURE);
74-
}
75-
}
76-
}
77-
7829
static void __attribute__ ((constructor)) sigsetup(void) {
7930
struct sigaction act;
8031
8132
memset(&act, 0, sizeof act);
8233
act.sa_handler = segvhandler;
8334
sigaction(SIGSEGV, &act, NULL);
84-
85-
act.sa_handler = iohandler;
86-
sigaction(SIGIO, &act, NULL);
8735
}
8836
*/
8937
import "C"

0 commit comments

Comments
 (0)