I have an application in which I iterate over an array of threads, each of which needs to be sent a specific signal. In Linux, this would look something like the following:
// my_threads is a vector of std::thread objects
for (auto i = my_threads.begin(); i != my_threads.end(); i++) {
pthread_kill(i->native_handle(), SIGPROF);
}
I am looking for the equivalent logic in Windows. That is, I want to be able to iterate over an array of std::thread
objects in a Windows environment, and send them each a specific type of signal.
You can assume that I have access to std::thread::native_handle for all threads in the loop, and that I am using the C++11 standard.
After I implement this, I would imagine the code would look something like this
// my_threads is a vector std::thread objects
for (auto i = my_threads.begin(); i != my_threads.end(); i++) {
#ifdef WIN32
// **How do I do this?**
WINDOWS_SIGNAL(i->native_handle(), SIGPROF);
#else
pthread_kill(i->native_handle(), SIGPROF);
#endif
}
I have looked for relevant Microsoft docs, and other SO posts, but haven't found anything even remotely relevant other than this tangentially related SO post.