En/na A.J. Venter ha escrit:
The synchronize calls shouldn't be placed inside your TThreadedProcess
code... they should be used in the main application thread to provide
mutual exclusion for the shared visual components.
It's the other way round, at least in delphi: you call synchronize from
a thread when you want the method executed in the context of the main
thread.
That is correct, I know this much at least :) after all how can you synchronize from the main thread it doesn´t know what the other thread is doing.

Mmmh, looking more closely to your code (I didn't before, I was just replying to the assertion that you call synchronize from the main thread) I don't think you should use synchronize at all (maybe a mutex to coordinate the access to FRunning, but even that may be overkill for a boolean): since you don't access the TStringList unless the process has ended there's no problem of simultaneous access from the main thread and the thread (and even if you wanted to do that I'd prefer a mutex over synchronize). In fact (not knowing the internals of the synchronize implementation, so I may be wrong) I cannot see how your thread can work since you're in a busy loop waiting for the thread to finish, so there's no way the main thread can schedule your synchronize call.

Bye
--
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004      Fax +34 93 5883007

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to