[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

3.0 libc_r.a signal bug!



The following code works when compiled with

   gcc test.c

but fails when compiled with

   gcc test.c -lc_r
or
   gcc test.c -pthread

I'm I to believe that no multithreaded apps on
OpenBSD are interruptable?

Kent Watsen

-- test.c --

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <stdbool.h>

bool alive = true;

static void handleFunc(int sig) {
   printf("interrupted!\n");
   alive = false;
}

int main(int argc, char* argv[]) {
   signal(SIGINT, handleFunc);
   while (alive==true) {
       printf("waiting...\n");
       usleep(100000);
   }
   printf("done\n");
   return 0;
}