Thanks Ben, all my thread code is already in Synchronize,  I just wondered
if it also needed to be in a critical section.  Im trying to debug an
intermittent bug in our app and everything is pointing to threads updating
the display at the moment.

Rob

Software engineer
Wild Software Ltd
Ph 03 338-1407
----- Original Message -----
From: "Ben Taylor" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Wednesday, August 14, 2002 2:35 PM
Subject: Re: [DUG]: Yet more thread questions


> hi,
>
> anything that updates the gui must be done from the main thread.
> syncronize will ensure this. critical sections will only ensure that
> you have exclusive access to the resource, which is not enough in this
> case.
>
> other approaches to the issue are:
> 1) post windows messages to the listview. this can be done from any
> thread. i usually avoid this approach (not particularly object
> oriented)
> 2) have the thread place data into a threadsafe list/queue, which the
> main thread polls and updates the listbox every second or so. i usually
> go for this approach, as it means the gui only changes once per second,
> not constantly in a state of change.
>
> hope that helps,
> ben.
>
> --- Robert Martin <[EMAIL PROTECTED]> wrote:
> > If I have component A (a listview) that my main VCL thread writes to
> > and
> > various other threads write to using Synchronize() is this safe or do
> > I need
> > Critical Sections around all the code that adds to the listview.
>
>
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to