#include <stdio.h>
#include <signal.h>
#include <pthread.h>

void intc(int x) {
  printf("thread %u got the signal\n", pthread_self());
}

void* thread_func(void *unused) {
  signal(SIGINT, intc);
  printf("child thread %u runs\n", pthread_self());
  sleep(1000);
}

main() {
  pthread_t th;
  printf("main thread %u runs\n", pthread_self());

  pthread_create(&th, NULL, thread_func, NULL);

  sleep(1000);
}
