1. time waits

Hi all,
In windoze, is it possible to do something other than this:

time1 = time()
 --wait 60 seconds
while time() < time1+60 do end while

to pause 60 seconds? That code is actually using cpu cycles, and i'd prefer 
to:

pause(60)

and to not use the cpu, and have windoze wake up the program at the 
following line in 60 seconds. I looked in the archives for "pause", "wait", and
"delay", but got no matches. Any thoughts? The only thing i can come up 
with is loop it thru mirc and use mirc's timers. Or is the answer buried 
somewhere in timer.exw? By the way, it says winmain takes two 
arguements, so i argued with it twice, but it won't stop saying that, no matter 
how much i argue at it. Must i use a winmain window if all i want is a timer?

Kat

new topic     » topic index » view message » categorize

2. Re: time waits

sleep(nn) will do it.  I've wondered just how much CPU time sleeping takes 
up...Anyone know?

Below is the description.  Good luck!
--Ted

sleep
Syntax: include misc.e
sleep(i)
Description: Suspend execution for i seconds.
Comments: On WIN32 and Linux, the operating system will suspend your 
process and schedule other processes. On DOS32, your program will go into a 
busy loop for i seconds, during which time other processes may run, but 
they will compete with your process for the CPU.
Example:
 puts(1, "Waiting 15 seconds...\n")
sleep(15)
puts(1, "Done.\n")



--On Saturday, May 19, 2001 5:03 PM -0500 Kat <gertie at PELL.NET> wrote:

>
>
> Hi all,
> In windoze, is it possible to do something other than this:
>
> time1 = time()
>  --wait 60 seconds
> while time() < time1+60 do end while
>
> to pause 60 seconds? That code is actually using cpu cycles, and i'd
> prefer  to:
>
> pause(60)
>
> and to not use the cpu, and have windoze wake up the program at the
> following line in 60 seconds. I looked in the archives for "pause",
> "wait", and   "delay", but got no matches. Any thoughts? The only thing i
> can come up  with is loop it thru mirc and use mirc's timers. Or is the
> answer buried  somewhere in timer.exw? By the way, it says winmain takes
> two
> arguements, so i argued with it twice, but it won't stop saying that, no
> matter  how much i argue at it. Must i use a winmain window if all i want
> is a timer?
>
> Kat
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: time waits

On 19 May 2001, at 17:07, Ted Fines wrote:

> 
> sleep(nn) will do it.  I've wondered just how much CPU time sleeping takes
> up...Anyone know?

Thanks, Ted, i dropped in sleep(10) and cpu useage dropped from 80% 
average to 1% on average! I *did* check the Eu help docs for time(r)-related 
words too, and they didn't come up with sleep().

Kat
 
> Below is the description.  Good luck!
> --Ted
> 
> sleep
> Syntax: include misc.e
> sleep(i)
> Description: Suspend execution for i seconds.
> Comments: On WIN32 and Linux, the operating system will suspend your 
> process and schedule other processes. On DOS32, your program will go into a
> busy
> loop for i seconds, during which time other processes may run, but they will
> compete with your process for the CPU. Example:
>  puts(1, "Waiting 15 seconds...\n")
> sleep(15)
> puts(1, "Done.\n")
> 
> 
> 
> --On Saturday, May 19, 2001 5:03 PM -0500 Kat <gertie at PELL.NET> wrote:
> 
> >
> >
> > Hi all,
> > In windoze, is it possible to do something other than this:
> >
> > time1 = time()
> >  --wait 60 seconds
> > while time() < time1+60 do end while
> >
> > to pause 60 seconds? That code is actually using cpu cycles, and i'd
> > prefer  to:
> >
> > pause(60)
> >
> > and to not use the cpu, and have windoze wake up the program at the
> > following line in 60 seconds. I looked in the archives for "pause",
> > "wait", and   "delay", but got no matches. Any thoughts? The only thing i
> > can
> > come up  with is loop it thru mirc and use mirc's timers. Or is the answer
> > buried  somewhere in timer.exw? By the way, it says winmain takes two
> > arguements, so i argued with it twice, but it won't stop saying that, no
> > matter  how much i argue at it. Must i use a winmain window if all i want is
> > a
> > timer?
> >
> > Kat
> >

new topic     » goto parent     » topic index » view message » categorize

4. Re: time waits

or use PeekMessage until the message changes then proceed.

I wasnt following close Kat, sorry.

if the condition is mouse or key related PeekMessage will hold
you in a loop until a button is depressed or a key is up by it's
self. 
And, you could concievably use SendMessage in conjunction
with sleep in a PeekMessage loop until your specified time is up.

Euman

----- Original Message ----- 
From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM>
To: "EUforum" <EUforum at topica.com>
Sent: Monday, May 21, 2001 10:11
Subject: RE: time waits


> 
> 
> 
> > -----Original Message-----
> > From: Kat [mailto:gertie at PELL.NET]
> > By the way, it says winmain takes two 
> > arguements, so i argued with it twice, but it won't stop 
> > saying that, no matter 
> > how much i argue at it. Must i use a winmain window if all i 
> > want is a timer?
> 
> You could probably get around opening a window by setting up your own event
> loop (see eventLoop in win32lib), but it's probably easier to hide the
> window when it opens, if you don't want to see it.  If you're just going to
> be calling sleep() and then doing other things, you may not need a window.
> If you actually want to use a windows timer, then you'll need to attach it
> to a window.
> 
> A timer sends a message to its window when it goes off.  You have to have
> your event loop set up to handle the messages sent by windows.
> 
> Matt Lewis
> 
> 
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu