Pithikos/C-Thread-Pool

'SIGUSR1' undeclared

aganm opened this issue · 1 comments

aganm commented

I get a couple of errors when trying to compile thpool.c

-- Configuring done
-- Generating done
-- Build files have been written to: D:/msys64/home/Projects/test/bin
D:/msys64/home/Projects/test/src/lib/thpool.c: In function 'thpool_pause':
D:/msys64/home/Projects/test/src/lib/thpool.c:249:47: error: 'SIGUSR1' undeclared (first use in this function)
  249 |   pthread_kill(thpool_p->threads[n]->pthread, SIGUSR1);
      |                                               ^~~~~~~
D:/msys64/home/Projects/test/src/lib/thpool.c:249:47: note: each undeclared identifier is reported only once for each function it appears in
D:/msys64/home/Projects/test/src/lib/thpool.c: In function 'thread_do':
D:/msys64/home/Projects/test/src/lib/thpool.c:336:19: error: storage size of 'act' isn't known
  336 |  struct sigaction act;
      |                   ^~~
D:/msys64/home/Projects/test/src/lib/thpool.c:337:2: warning: implicit declaration of function 'sigemptyset' [-Wimplicit-function-declaration]
  337 |  sigemptyset(&act.sa_mask);
      |  ^~~~~~~~~~~
D:/msys64/home/Projects/test/src/lib/thpool.c:340:6: warning: implicit declaration of function 'sigaction' [-Wimplicit-function-declaration]
  340 |  if (sigaction(SIGUSR1, &act, NULL) == -1) {
      |      ^~~~~~~~~
D:/msys64/home/Projects/test/src/lib/thpool.c:340:16: error: 'SIGUSR1' undeclared (first use in this function)
  340 |  if (sigaction(SIGUSR1, &act, NULL) == -1) {
      |                ^~~~~~~
D:/msys64/home/Projects/test/src/lib/thpool.c:336:19: warning: unused variable 'act' [-Wunused-variable]
  336 |  struct sigaction act;
      |                   ^~~
make[2]: *** [CMakeFiles/test.dir/build.make:5491: CMakeFiles/test.dir/src/lib/thpool.c.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:125: CMakeFiles/test.dir/all] Error 2
make: *** [Makefile:104: all] Error 2
 [ 0%] Building C object CMakeFiles/test.dir/src/lib/thpool.c.obj

Any idea how to fix those?

Add #include <signal.h>