472,980 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,980 software developers and data experts.

c no busy waiting loop


My question is as follows I have a condition x which I need to signal the current program to begin processing i/o. and when condition x is not met I need the program to sleep. I am pretty sure that the following is correct

my question is how do I get it to recognize it's time to send a signal without having it continually poll to see if the condition is met.

//sigHandler defined elsewhere
signal(SIGHUP,sigHandler); //register signal
pause(); //have process wait for sig
if( x==4) < -- is this still considered busy wait since it still needs to check to see
//if condition met
kill(getpid(),SIGHUP); //where SIGHUP can be any predefined signal in signal.h


any help would be greatfully appreciated,


Nov 21 '07 #1
1 5658
9,208 Expert Mod 8TB
You have to continuously poll. Usually you poll and then sleep for a specified number of milliseconds.
Nov 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Paul L. Du Bois | last post by:
Has anyone written a Queue.Queue replacement that avoids busy-waiting? It doesn't matter if it uses os-specific APIs (eg WaitForMultipleObjects). I did some googling around and haven't found...
by: Smegly | last post by:
Hi, I want to write a routine that periodically ( every t seconds) gets a value from a file and puts in into a queue. How can i implement this without getting into a busy-waiting loop . . ...
by: marc.gibian | last post by:
I am writing a simple C# application to read some files in an FTP drop directory. Occasionally the program will attempt to open a file that is in the process of being written. FileStream will throw...
by: Javaman59 | last post by:
I have a real-time simulation where the logic flows most easily with a busy while loop... while (continueFlagSet) { if (EventDue) ProcessNextEvent } Now, is there any thing to be concerned...
by: Raymond Lewallen | last post by:
How to wait for a process to stop completion is my goal. Obviously, the looping while waiting for the HasExited property is not a solution.. but thats the best I can come up off the top of my...
by: Michael S. Scherotter | last post by:
I have a proxy class derived from System.Web.Services.Protocols.SoapHTTPClient that calls a web service. Sometimes, because the call takes a longer time, I get the OLE server busy dialog. Is...
by: vul | last post by:
I need to copy the file (OutboxLog.txt produced by Fax service) right after it was updated. I'm using: System.IO.File.Copy(strSource, strDestination, True) to do that, but if the source file is...
by: placid | last post by:
Hi all, Just wondering if the cmd module in python uses "busy waiting" for "polling" user command input as this is inefficient. Cheers
by: mike3 | last post by:
Hi. Busy-waiting is a known anti-pattern that should be avoided. However, in C, there is no standard alternative, so when a wait is required and it's not busy, the program becomes 100%...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.