Re: sleep()

new topic     » goto parent     » topic index » view thread      » older message » newer message

On 13 Jun 2003, at 16:23, Derek Parnell wrote:

> 
> 
> On Fri, 13 Jun 2003 01:13:59 -0500, <gertie at visionsix.com> wrote:
> 
> >
> > Someone tell someone else that sleep(0) returns the cpu to the OS 
> > (windoze) without setting a timer, and the OS can indeed run the next 
> > application? It's a holdover from win3.x programming, wherein the app had to
> > relinquish the cpu for the task scheduler to run the next app.
> >
> To quote the Microsoft SDK...
> 
> 
> Sleep
> The Sleep function suspends the execution of the current thread for at 
> least the specified interval.
> 
> 
> VOID Sleep(
>   DWORD dwMilliseconds   // sleep time
> );
> Parameters
> dwMilliseconds [in] Specifies the minimum time interval, in milliseconds, 
> for which execution is to be suspended. A value of zero causes the thread 
> to relinquish the remainder of its time slice to any other thread of equal
> priority that is ready to run. If there are no other threads of equal priority
> ready to run, the function returns immediately, and the thread continues
> execution.
> 
> Return Values
> This function does not return a value.
> 
> Remarks
> This function causes a thread to relinquish the remainder of its time slice
> and
> become unrunnable for at least the specified number of milliseconds, after
> which
> the thread is ready to run. In particular, if you specify zero milliseconds,
> the
> thread will relinquish the remainder of its time slice but remain ready. Note
> that a ready thread is not guaranteed to run immediately. Consequently, the
> thread may not run until some time after the specified interval elapses. For
> more information, see Scheduling Priorities.

Thanks muchly, Derek!

To who questioned me:  tongue

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu