platform independant wait

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

platform independant wait

Marc Santhoff
Hi,

the subject tells what I'm searching for:

How can i wait a definit amount of time in a platform independant way?

I need to pause a while loop for 1 second. The program should run at
least on FreeBSD and Windows.

<snip>
while NOT doStop do begin
        { wait a little }
       
        doSomethingUseful;
end;
</snip>

At the moment I'm thinking of using something like
"Application.ProcessMessages" and measuring the time explicitely, but a
simple "Wait(1000)" would be best. :)

TIA,
Marc


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: platform independant wait

Jonas Maebe-2

On 04 Mar 2006, at 19:16, Marc Santhoff wrote:

> How can i wait a definit amount of time in a platform independant way?

There's the delay() procedure in the crt unit.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: platform independant wait

Vincent Snijders
In reply to this post by Marc Santhoff
Marc Santhoff wrote:

> Hi,
>
> the subject tells what I'm searching for:
>
> How can i wait a definit amount of time in a platform independant way?
>
> I need to pause a while loop for 1 second. The program should run at
> least on FreeBSD and Windows.
>
> <snip>
> while NOT doStop do begin
>         { wait a little }
>        
>         doSomethingUseful;
> end;
> </snip>
>
> At the moment I'm thinking of using something like
> "Application.ProcessMessages" and measuring the time explicitely, but a
> simple "Wait(1000)" would be best. :)
>

What about sleep:
http://www.freepascal.org/docs-html/rtl/sysutils/sleep.html

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: platform independant wait

Marc Santhoff
Am Samstag, den 04.03.2006, 19:33 +0100 schrieb Vincent Snijders:

> Marc Santhoff wrote:
> > Hi,
> >
> > the subject tells what I'm searching for:
> >
> > How can i wait a definit amount of time in a platform independant way?
> >
> > I need to pause a while loop for 1 second. The program should run at
> > least on FreeBSD and Windows.
> >
> > <snip>
> > while NOT doStop do begin
> >         { wait a little }
> >        
> >         doSomethingUseful;
> > end;
> > </snip>
> >
> > At the moment I'm thinking of using something like
> > "Application.ProcessMessages" and measuring the time explicitely, but a
> > simple "Wait(1000)" would be best. :)
> >
>
> What about sleep:
> http://www.freepascal.org/docs-html/rtl/sysutils/sleep.html

Yes, that's it.

Note to myself: do not use old docs for fpc 1.9.4.

Thank you all,
Marc


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal