Subgoal:
===============
//#include <pthread.h>
#include <pth.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
/* Simple error handling functions */
#define handle_error_en(en, msg) \
do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)
static void *
sig_thread(void *arg)
{
sigset_t *set = arg;
int s, sig;
for (;;) {
s = sigwait(set, &sig);
if (s != 0)
handle_error_en(s, "sigwait");
printf("Signal handling thread got signal %d\n", sig);
}
}
int
main(int argc, char *argv[])
{
pthread_t thread;
int s;
/* Block SIGQUIT and SIGUSR1; other threads created by main()
will inherit a copy of the signal mask. */
sigemptyset(&set);
sigaddset(&set, SIGQUIT);
sigaddset(&set, SIGUSR1);
s = pthread_sigmask(SIG_BLOCK, &set, NULL);
if (s != 0)
handle_error_en(s, "pthread_sigmask");
s = pthread_create(&thread, NULL, &sig_thread, &set);
if (s != 0)
handle_error_en(s, "pthread_create");
/* Main thread carries on to create other threads and/or do
other work. */
pause(); /* Dummy pause so we can test program */
}
=============
I changed #include <pthread.h> to <pth.h>
I might still be confused between pthread.h and pth.h.
I have copied: /pth/lib/ into /home/paul/opt/cross/i386-pc-msdosdjgpp/lib/
adjusting lastl line of .la files to that directory.
I have copied pth.h and pthread.h to: /home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/
While trying to compile subgoal program: I just commented out #include line not working in pth.h...
paul@kasparno:~/sigset$ i386-pc-msdosdjgpp-gcc sigset.c -lpthread -lpth
In file included from sigset.c:2:
/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/pth.h:43:10: fatal error: sys/wtime.h: No such file or directory
43 | #include <sys/wtime.h> /* for struct timespec */
| ^~~~~~~~~~~~~
compilation terminated.
paul@kasparno:~/sigset$ i386-pc-msdosdjgpp-gcc sigset.c -lpthread -lpth
In file included from sigset.c:2:
/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/pth.h:45:10: fatal error: sys/socket.h: No such file or directory
45 | #include <sys/socket.h> /* for sockaddr */
| ^~~~~~~~~~~~~~
compilation terminated.
paul@kasparno:~/sigset$ i386-pc-msdosdjgpp-gcc sigset.c -lpthread -lpth
In file included from /home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/pth.h:47,
from sigset.c:2:
/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/sys/select.h:21:10: fatal error: features.h: No such file or directory
21 | #include <features.h>
| ^~~~~~~~~~~~
compilation terminated.
paul@kasparno:~/sigset$
So, the sys/select.h (that I put in /home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/sys/ ).
That's where I am at for now... asking here for help.