Results 1 to 1 of 1
Thread: Generating signals for pselect()
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- May 2011
Generating signals for pselect()
I was wondering if anyone knew of a way to check out the pselect() signal handling functionality? I was trying to do this with the Linux serial port drivers, but fell short since I don't know how to make the ttyS0 driver generate a signal so that pselect() can be interrupted and the signal handled?
Here's a snippet of code for how I'm using the pselect().
sigset_t emptyset, blockset;
sigemptyset(&blockset); /* Block SIGINT */
sigprocmask(SIG_BLOCK, &blockset, NULL);
sa.sa_handler = handler; /* Establish signal handler */
sa.sa_flags = 0;
sigaction(SIGINT, &sa, NULL);
/* Initialize nfds and readfds, and perhaps do other work here */
/* Unblock signal, then wait for signal or ready file descriptor */
ready = pselect(nfds, &readfds, NULL, NULL, NULL, &emptyset);