LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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: 4,864
Blog Entries: 1

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

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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



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 08:36 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
Open Source Consulting | Domain Registration