[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with usleep?

I don't need a real time sleep, I just need to be sure that the process sleeps
so I can give the cycles to another process.
what sort of signal would interrupt usleep?  Is there a better way to do this?


Randy Scarborough wrote:
> Read the man page for usleep very carefully. usleep can be interrupted at
> any time by another signal.
> If your trying to get a real time affect from usleep, it'll never happen. In
> other words, usleep is not garanteed to delay for the total amount of time
> that you pass to it.
> Personally I only use usleep when I want to give other threads or processes
> a chance for some cpu cycles and usleep(1) does the trick.
> Try using nanosleep instead ( again, read the man page carefully ).
> nanosleep will allow you to determine how long you slept.
> ----- Original Message -----
> From: "Kevin Wooley" <kwooley@xxxxxxx.com>
> To: <dev-etrax@xxxxxxx.com>
> Sent: Monday, June 23, 2003 4:44 PM
> Subject: problem with usleep?
> > Anybody know if there is a problem with using usleep on the ETRAX100LX?
> I've
> > got an application that uses it fairly often to delay, and I'm wondering
> if it
> > might be causing a strange bug I'm having.
> >
> > thanks,
> >
> > Kevin
> >