Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-06

Suspending app

4 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Darius Blaszijk

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

SteveG
to Darius Blaszijk

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

Darius Blaszijk wrote 17 lines
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 - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Michael Van Canneyt
to Darius Blaszijk: I have an app that checks several files continuously and when the fileage has changed the…
Darius Blaszijk wrote 7 lines
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.

Tomas Hajny
to Darius Blaszijk: I have an app that checks several files continuously and when the fileage has changed the…

Darius Blaszijk said:

Show quoted text 8 lines
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