Suspending app

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

Suspending app

Darius Blaszyk
Hi,

I have an app that checks several files continuously and when the fileage
has changed the app performs some instructions. I have put the checks in a
loop. The drawback is that the processor is now 100% loaded. I could use the
FindFirstChangeNotification API on windows. But is there a crossplatform
alternative??

Darius Blaszijk


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

Re: Suspending app

Steve Gatenby
perhaps create a thread for your file checking code, and Sleep(xx)
regularly to release the processor ?

Darius Blaszijk wrote:

> Hi,
>
> I have an app that checks several files continuously and when the fileage
> has changed the app performs some instructions. I have put the checks in a
> loop. The drawback is that the processor is now 100% loaded. I could use the
> FindFirstChangeNotification API on windows. But is there a crossplatform
> alternative??
>
> Darius Blaszijk
>
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
>


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

Re: Suspending app

Michael Van Canneyt
In reply to this post by Darius Blaszyk


On Tue, 21 Jun 2005, Darius Blaszijk wrote:

> Hi,
>
> I have an app that checks several files continuously and when the fileage
> has changed the app performs some instructions. I have put the checks in a
> loop. The drawback is that the processor is now 100% loaded. I could use the
> FindFirstChangeNotification API on windows. But is there a crossplatform
> alternative??

Not yet, although work is being done on that.
Try using a sleep() call. It will suspend the app for a number of milliseconds.

Michael.

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

Re: Suspending app

Tomas Hajny
In reply to this post by Darius Blaszyk
Darius Blaszijk said:
> Hi,
>
> I have an app that checks several files continuously and when the fileage
> has changed the app performs some instructions. I have put the checks in a
> loop. The drawback is that the processor is now 100% loaded. I could use
> the
> FindFirstChangeNotification API on windows. But is there a crossplatform
> alternative??

"SysUtils.Sleep (5)", or "Drivers.GiveUpTimeSlice" (unit Drivers is part
of FreeVision).

Tomas


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