[ee122] Question regarding how to implement a timeout

Lisa Fowler fowler at eecs.berkeley.edu
Thu Nov 29 00:21:12 PST 2007


You can use select() in this case.  You may find need for a timer in
non-select-based cases, and if so, check out time(), clock(), and
gettimeofday().

There's also polling (via poll()), but I think select will do you just fine.

-Lisa

On Nov 29, 2007 12:15 AM, Anthony Kilman <a_kilman at berkeley.edu> wrote:
> Quick question.. how should we implement a timeout? One obvious way
> would be to use time.h in a while loop.. but just from glancing at my
> processor usage that seems to eat a lot of cycles.. would select() be a
> better solution (although its not needed) ? The reason I ask is that I
> think in Beej's guide somewhere it mentioned sending the process to
> sleep until some activity occurred.
>
> Thanks in advance.
>
> Anthony
>
> _______________________________________________
> ee122 mailing list
> ee122 at mailman.ICSI.Berkeley.EDU
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122
>


More information about the ee122 mailing list