Subject: Re: usleep and signals To: None <> From: maximum
entropy <> List: current-users Date: 08/18/1997 12:07:23 >From:
Rick Byers <> >Granularity of 1 second is fine.  But after
looking at the source (I >didn't feel like thinking at it at
3:00am last night <grin>), I see a >problem.  Sleep will still
respond to my timer even though I have set it >to ignore, and
since my timer fires once a second, this poses the same >problem
as just sleeping for the desired time.  The time difference
>returned by sleep when it's interrupted is only accurate to the
second. >The obvious work around is to simply dissable my timer,
and re-enable it >afterwards.  I don't think I have to worry
about changing the signal >handler because sleep does that for
me.  Does this sound ok?  Yes, calling alarm(0) before the sleep
and then resetting the alarm afterwards should do what you want.
>Your patch for usleep worked fine.  The nanosleep man page even
says it >will return an error if tv_nsec is greater than 1
billion (1 second).  Th