// Test raising SIGIO on a C thread with an alternate signal stack
// when there is a Go signal handler for SIGIO.
-static void* thread1(void* arg) {
- pthread_t* ptid = (pthread_t*)(arg);
+static void* thread1(void* arg __attribute__ ((unused))) {
stack_t ss;
int i;
stack_t nss;
// Send ourselves a SIGIO. This will be caught by the Go
// signal handler which should forward to the C signal
// handler.
- i = pthread_kill(*ptid, SIGIO);
+ i = pthread_kill(pthread_self(), SIGIO);
if (i != 0) {
fprintf(stderr, "pthread_kill: %s\n", strerror(i));
exit(EXIT_FAILURE);
// Test calling a Go function to raise SIGIO on a C thread with an
// alternate signal stack when there is a Go signal handler for SIGIO.
-static void* thread2(void* arg) {
- pthread_t* ptid = (pthread_t*)(arg);
+static void* thread2(void* arg __attribute__ ((unused))) {
stack_t ss;
int i;
int oldcount;
+ pthread_t tid;
stack_t nss;
// Set up an alternate signal stack for this thread.
// Call a Go function that will call a C function to send us a
// SIGIO.
- GoRaiseSIGIO(ptid);
+ tid = pthread_self();
+ GoRaiseSIGIO(&tid);
// Wait until the signal has been delivered.
i = 0;
// Tell the Go library to start looking for SIGIO.
GoCatchSIGIO();
- i = pthread_create(&tid, NULL, thread1, (void*)(&tid));
+ i = pthread_create(&tid, NULL, thread1, NULL);
if (i != 0) {
fprintf(stderr, "pthread_create: %s\n", strerror(i));
exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
- i = pthread_create(&tid, NULL, thread2, (void*)(&tid));
+ i = pthread_create(&tid, NULL, thread2, NULL);
if (i != 0) {
fprintf(stderr, "pthread_create: %s\n", strerror(i));
exit(EXIT_FAILURE);