>
> 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.
>
Okay, let me explain exactly what I wish to achieve.
I want to be able to stick a tmemo on a form, call tthreadedprocess with a 
command that takes a long time to run and has a lot of output (lets say 
¨find /¨ for an example) - and have the output scrolling into the tmemo LIVE 
as it arrives, hence the call to synchronize every time the tmemstream 
reaches 2048 bytes.

The main thread is not meant to be ANYWHERE in this class, this class is meant 
to create a thread, and then FEED the output of the tprocess to the main 
thread (in the calling appplication) LIVE.

So while it´s true that I don´t use FOutPut in this class -that is because I 
want to be able to use it in the calling application.
Having explained this, does it clarify why the code looks as it does ?

A.J.
-- 
"80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so."
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com       | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za    | +55 118 162 2079 (Brazil)

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

Reply via email to