You will find CPU usage goes way down if you slow
the loop down using sleep(). Even Sleep(10) should significantly
reduceCPU usage. The higher the better of course.
Ross.
- Original Message -
From:
Phil Middlemiss
To: NZ Borland Developers Group - Delphi
List
Hi Phil
I came across the same problem. I got around it by
puttingsleep(1) in the execute method, when the thread wasn't actually
processing any data.
Todd.
- Original Message -
From:
Phil Middlemiss
To: NZ Borland Developers Group - Delphi
List
Sent:
Phil
The old polling v interupt driven process problem
since you are polling you can prob only poll say every
period that could only cause the buffer to be 1/2 full
Neven MacEwan (B.E. EE)
Ph. 09 621 0001 Mob. 0274 749062
Phil Middlemiss wrote:
I have a thread that sits in the background waiting
Phil
IMO you should not call ProcessMessages in
a thread that should be handled in the Main thread only.
To avoid 100% CPU usage try:
while not terminated do
begin
if MyTest then
DoMyProcess;
Wait(1);
end;
Even using Wait(0) avoids the thread
hogging resources.
HTH
Sorry that should have been Sleep(), not Wait()
Must be Friday J
Phil
IMO you should not call ProcessMessages in
a thread that should be handled in the Main thread only.
To avoid 100% CPU usage try:
while not terminated do
begin
if MyTest then
DoMyProcess;
Sleep(1);
Phil Middlemiss asked:
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?
Either use WaitMessage to suspend the thread until a message is available
for it, or use MsgWaitForMultipleObjects if
I would like to log all packets that pass through this component. Is
there any way of doing it?
I can't see an easy way.
Ta,
Dave.
___
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi
Thanks to all who replied. I will have a play - I
don't think I can get away with not calling ProcessMessages tho, since the COM
port component I use uses Timer messages to poll the COM port. I'll let you know
anyway.
Cheers,
Phil.
- Original Message -
From:
Stephen Bertram
___
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi
Hi Phil
Why don't you suspend your thread when processing
has completed. Whenever data is received from the comport, call
resume.
Rob MartinSoftware Engineerphone 03 377 0495fax 03
377 0496 web www.chreos.comWild Software Ltd
- Original Message -
From:
Phil Middlemiss
Is it just me or is [EMAIL PROTECTED] adding a lot to this discussion :)
Rob Martin
Software Engineer
phone 03 377 0495
fax 03 377 0496
web www.chreos.com
Wild Software Ltd
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, October 15, 2004 12:18 PM
___
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
It's not just You Robert. Perhaps [EMAIL PROTECTED] is out of the office
with auto-reply recently turned on. Or is it a virus on the mail server?
Daryl Marsden
Project Management Analyst
Environment Canterbury
P O Box 345
Christchurch
Phone (03) 365-3828 Ext 7141
Fax (03) 365-3194
___
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi
Theres your reply Daryl :-)
Jeremy
-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Date: Fri, 15 Oct 2004 12:43:53 +1300
Subject: RE: [DUG] Thread processes
___
Delphi mailing list
[EMAIL PROTECTED]
If your looking for a good interupt com component check out APRO at
http://sourceforge.net/projects/tpapro/
-Original Message-
From: Neven MacEwan [mailto:[EMAIL PROTECTED]
Sent: Friday, 15 October 2004 11:34 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Thread
We have just had some code migrated from D5 to D7 and it has
broken because the compiler can not distinguish between integer
and int64 parameters.
Is this a known problem ?
Regards
Rohit
==
CFL - Computer Fanatics Ltd. 21
___
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi
Has no-one any experience with this component?
Is there another easy way of proxying a connection on a specific port
where I could log all the traffic?
Dave.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of David O'Brien
Sent: Friday, 15 October 2004
Very nice component suite. Thanks Alan.
Using a combination of the suggestions you all made, the CPU usage is no
longer an issue. Thanks to all who helped.
And a special thanks to the staff at belding.co.nz whose continual replies
did not contain a single bad suggestion!
Cheers,
Phil.
-
21 matches
Mail list logo