abort_multithread.c 515 B

1234567891011121314151617181920
  1. #include <pthread.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. /* Test if abort() in a child thread kills the whole process. This should report 134 (128 + 6 where
  5. * 6 is SIGABRT) as its return code. */
  6. void* thread_abort(void* arg) {
  7. abort();
  8. return NULL; /* not reached */
  9. }
  10. int main(int argc, char* arvg[]) {
  11. pthread_t thread;
  12. pthread_create(&thread, NULL, thread_abort, NULL);
  13. pthread_join(thread, NULL);
  14. printf("Main thread returns successfully (must not happen)\n");
  15. return 0;
  16. }