Implementing a Timeout in C/C++
- From: wade.lindsey@xxxxxxxxx
- Date: 15 Mar 2006 14:12:16 -0800
Hello all -
I am attempting to implement a timeout condition in C/C++ and am
finding very little resources on doing such a thing. In ADA, I would
do something like this:
select
accept An_Entry do
end An_Entry;
or
delay 5.0;
Put("An_Entry: timeout");
end select;
but don't confuse ADA's select() with C's...
Anyway, what I'm trying to do is:
while (ERROR_CONDITION)
{
<Wait for either 10 Seconds to expire or ERROR_CONDITION == 0>
}
basically, a straitforward timeout...
Is there anyway to achieve this without using sleep? I have other
actions going on in the background that I don't want to suspend, I just
want a max-timed while loop - is that possible?? Trivial??
Thanks,
Wade
.
- Follow-Ups:
- Re: Implementing a Timeout in C/C++
- From: Ian Collins
- Re: Implementing a Timeout in C/C++
- From: Micah Cowan
- Re: Implementing a Timeout in C/C++
- From: Roger Leigh
- Re: Implementing a Timeout in C/C++
- Prev by Date: Re: removing a loop cause it to go at half the speed?
- Next by Date: Re: removing a loop cause it to go at half the speed?
- Previous by thread: removing a loop cause it to go at half the speed?
- Next by thread: Re: Implementing a Timeout in C/C++
- Index(es):
Relevant Pages
|