I would consider creating something like a stats object as an intermediary
between your reading thread and the updating on the main thread. Something
along the lines of the following.
Update the values that you need in the update events from the read thread,
then on the mainform have a timer which also reads from this object.
Matt.
type
TStatOb = class(Tobject)
private
fVal1:integer;
fSC_Val1:tCriticalSection;
function ReadVal1:integer;
procedure SetVal1(value:integer);
public
constructor create;
destructor destroy; override;
property Val1:integer read ReadVal1 write SetVal1;
end;
implementation
{ TStatOb }
constructor TStatOb.create;
begin
fSC_Val1:=tcriticalsection.create;
end;
destructor TStatOb.destroy;
begin
fSC_Val1.free;
inherited;
end;
function TStatOb.ReadVal1: integer;
begin
fSC_Val1.Enter;
result:=fval1;
fSC_Val1.Leave;
end;
procedure TStatOb.SetVal1(value: integer);
begin
fSC_Val1.Enter;
fval1:=value;
fSC_Val1.Leave;
end;
----- Original Message -----
From: "Ben Taylor" <[EMAIL PROTECTED]>
To: "NZ Borland Developers Group - Delphi List" <[email protected]>
Sent: Sunday, June 19, 2005 4:55 PM
Subject: Re: [DUG] graphics stops updating
hi,
this indicates you are updating your ui from outside the main thread,
which is not
allowed as the vcl is not threadsafe. it is unlikely to be a bug in your
audio
components.
you need to implement a threadsafe mechanism to update your ui, possibly
using
critical sections or thread.synchronize.
sorry, i don't have time to show an example right now.. maybe someone else
has a
block of code to show?
hope that helps,
b
--- Ross Levis <[EMAIL PROTECTED]> wrote:
Hi Ben
I added the Assert. I also had to turn on Asserts in the Compiler
options. Execution stopped at the Assert. Does this mean a bug in the
audio component I'm using?
I'm using this excellent free audio component suite for Delphi, Kylix
and Lazarus.
http://www.compiler4.net/acs/index.html
Thanks,
Ross.
----- Original Message -----
From: "Ben Taylor" <[EMAIL PROTECTED]>
To: "NZ Borland Developers Group - Delphi List" <[email protected]>
Sent: Sunday, June 19, 2005 4:10 PM
Subject: Re: [DUG] graphics stops updating
add this to the procedure that updates the components. if it fails, then
you have a
threading issue.
uses windows;
..
Assert(GetCurrentThreadId=MainThreadID);
otherwise, you'll probably need to show some code..
--- Ross Levis <[EMAIL PROTECTED]> wrote:
> The figures are coming from a thread and updating on an event, but
> this is not the
> problem. I currently have 7 different controls on the screen showing
> the data
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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
__________________________________
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail
_______________________________________________
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