LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-13-2018, 07:51 AM   #1
Jethro63
LQ Newbie
 
Registered: Feb 2018
Location: Toronto
Posts: 2

Rep: Reputation: Disabled
Question 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
 
Old 02-13-2018, 10:57 PM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,505

Rep: Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080Reputation: 1080
How about select or poll
Or SIGIO? Or aio?
 
Old 02-14-2018, 07:05 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 6,793
Blog Entries: 12

Rep: Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423
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.
 
Old 02-14-2018, 12:36 PM   #4
Jethro63
LQ Newbie
 
Registered: Feb 2018
Location: Toronto
Posts: 2

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] init script successfully triggers daemon process but doesn't create pid file -Deb7 linuxecho Linux - Newbie 1 02-17-2014 10:45 AM
unblocking domain? jane_mkd Ubuntu 1 09-17-2010 09:40 PM
unblocking a domain jane_mkd Linux - Security 7 09-17-2010 03:47 PM
Unblocking port 80 chownuseradd Linux - Newbie 3 07-29-2008 02:30 AM
unblocking a port Solvaut Linux - Newbie 3 07-15-2005 05:53 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration