You will find CPU usage goes way down if you slow the loop down using sleep().  Even Sleep(10) should significantly reduce CPU usage.  The higher the better of course.
 
Ross.
----- Original Message -----
Sent: Friday, October 15, 2004 11:16 AM
Subject: [DUG] Thread processes

I have a thread that sits in the background waiting for input from a COM port. the execute method simple has these two lines:
 
  while not Terminated do
    Application.ProcessMessages;
The problem with this is that the processor usage is very high, even if the thread is doing nothing but sitting there calling processmessages.
 
The main application thread doesn't have this problem, yet it also has a message handling routine. Is there a way to avoid this problem in threads?
 
Cheers,
Phil.


_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to