in reply to Re: I want to forfeit my timeshare
in thread I want to forfeit my timeshare

Regardless of the fraction of a second I can sleep, I'm still locking myself to n checks per second. I want to check once each time I get a time slice, but every time I get a time slice. If I limit myself to every tenth of a second, when the program runs a 100 Ghz machine it will still only check ten times per second.

____________________
Jeremy
I didn't believe in evil until I dated it.

Replies are listed 'Best First'.
(MeowChow) Re3: I want to forfeit my timeshare
by MeowChow (Vicar) on Aug 24, 2001 at 23:04 UTC
    Not true; select will wake your process if there are any pending filehandle events (read/write/error), before the timelimit is up. The argument is simply a timeout, after which control is returned to your program, assuming no events occur.

    If your problem with select is that it doesn't allow you to wait on the other types of events, then it would help if you mentioned exactly what sorts of events you're catching. In the meantime, I'd suggest looking at Event (or POE, which I don't particularly like).

       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print
Re: Re: Re: I want to forfeit my timeshare
by Cine (Friar) on Aug 24, 2001 at 22:15 UTC
    Sleep (0) is the answer, because it is not optimized away. (and since sleep is implemented using select...).

    T I M T O W T D I