All sources say that the types sigaction , sigset_t are in signal.h This line is present at my very top:

#include <signal.h> 

But the environment still does not see sigaction and sigset_t . Writes id is not defined. Is it because I have Windows OS? But pthread.h works. Can I do something here?

    1 answer 1

    The csignal header files in C ++ and signal.h in C standard contain declarations of only two functions, signal and raise . All the rest are posix or self-made extensions. pthread.h is a non-standard header and if it works for you, then you just have some kind of library installed that emulates the posix interface. Signals, if desired, can also be implemented somehow, but why?

    • well here in example code there is signal.h and sigset_t is used - zhukov
    • "Signals, if desired, can also be implemented somehow, but why?" It is necessary to solve the problem: Write a program that creates a new thread (using pthread_create ()). The parent stream (in which the new thread was created) should send a SIGINT signal to the child (created). The child stream should intercept this signal and print its identifier ( pthread_self ()) and the incoming signal. - zhukov pm
    • @zhukov Well, and then it just says POSIX.4a . pthread_self returns a thread descriptor, not a thread id. Windows has Windows Subsystem for Linux or Cygwin - VTT
    • And if pthread_self removed (even if the child stream prints only the incoming signal), then can it be solved without all that you wrote? - zhukov
    • @zhukov This task clearly assumes its execution in a POSIX-compatible environment. Trying to create such an environment on your own is clearly overkill. - VTT