octave-maintainers
[Top][All Lists]
Advanced

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

Re: Sleep on Windows systems


From: Paul Kienzle
Subject: Re: Sleep on Windows systems
Date: Wed, 2 Oct 2002 13:00:00 -0400

We don't need to be that sophisticated since we are not event
driven.  Seems to me their code is wrong, too.  As well as
sleeping for the entire time, are they not also "sleeping"
for the time required to process the event queue?

What I need is a test of whether I am to use the Windows API
or if there is some underlying posix layer I can rely upon.

How about (untested):

        #if defined(__WIN32__) && !defined(__POSIX__)

- Paul

On Wed, Oct 02, 2002 at 09:37:03AM -0500, John W. Eaton wrote:
> Here's what R does, in a Windows-specific source file:
> 
>   SEXP do_syssleep(SEXP call, SEXP op, SEXP args, SEXP rho)
>   {    DWORD mtime;
>       int ntime;
>       double time;
> 
>       checkArity(op, args);
>       time = asReal(CAR(args));
>       if (ISNAN(time) || time < 0)
>         errorcall(call, "invalid time value");
>       ntime = 1000*(time) + 0.5;
>       while (ntime > 0) {
>         mtime = min(500, ntime);
>         ntime -= mtime;
>         Sleep(mtime);
>         R_ProcessEvents();
>       }
>       return R_NilValue;
>   }
> 
> So maybe we should just do something similar in sysdep.cc inside an
> #ifdef for WIN32 (or whatever is the appropriate macro).
> 
> jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]