LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Unblocking a Process on Two or More Triggers (https://www.linuxquestions.org/questions/programming-9/unblocking-a-process-on-two-or-more-triggers-4175623654/)

Jethro63 02-13-2018 07:51 AM

Unblocking a Process on Two or More Triggers
 
Greetings:
I am programming a Linux application for an embedded system - the processor is an ARM-Cortex-7 but I'm finding that I can build the code on all sorts of targets with little or no changes.

Anyway, I've run into a delemma: I have processes that block waiting for input from sockets or input from queues or input from USB-serial ports - things like that. It's all very straight-forward.

What I am finding difficult is arranging for a process to unblock itself on an "Either-OR" basis. For example, maybe I have a process that waits for input from a queue but I might also want it to wake up periodically on a timer.

How is this done, generally? Is there are "general" way of doing this or am I being a bit naive? I am finding it surprising how difficult this is.

Thank you,
Mark

NevemTeve 02-13-2018 10:57 PM

How about select or poll
Or SIGIO? Or aio?

rtmistler 02-14-2018 07:05 AM

Hi Jethro63, I wrote a blog entry about Select.

There are also other Linux programming applications blog entries about a USB receiver/parser, a controlling/monitoring daemon process, and other entries if you wish to peruse.

I feel select() is a great option. You could also consider threads, but generally I prefer processes.

Jethro63 02-14-2018 12:36 PM

Thanks guys.
I had not known about select() and I had spent a lot of time looking around. It seems like you just have to enter the right search parameters.
I will give this a try.
Mark


All times are GMT -5. The time now is 08:04 AM.