Michael Van Canneyt wrote:
> On Wed, 12 Dec 2007, Razvan Adrian Bogdan wrote:
> > The synchronize method is simple but inefficient, it pauses your
> > thread until the main thread has time to execute your code and could
> > take some time until it does, i personally also dislike the fact that
> > one cannot call any procedure/function with any number of parameters
> > with synchronize.
>
> That's not possible in pascal without hacking the stack.

Why?

> > I think mark proposed once the solution of using a List (StringList or
> > something else) in a synchronised manner with CriticalSections
> > protecting access to the list and this way creating a message system
> > similar to the OS one but this implementation is also not always
> > comfortable but it isn't blocking as synchronize, the problem is not
> > with the windows widgetset which is message based and quite thread
> > safe and one can easily use CriticalSections with Controls, Borland
> > started to make the VCL threadsafe but they didn't complete this task,
> > maybe LCL would be more popular if it was threadsafe, i do realise
> > it's a lot of work but it might be worth it.
>
> This may work for windows, but X is not thread safe, so you would have
> maybe a slightly less blocking system, but it would be blocking
> nonetheless. I think the gain would be minimal.

This is basically the problem with threading:  it's not enough for your code 
to be thread-safe, you also need to make sure all linked libs are 
thread-safe, which makes threading only useful for code you control.

So, making the LCL thread-safe is really the easy part, but more importantly 
you need to make sure that all libs the LCL links to are thread-safe.

One easy work-around may be to run your app multi-processed instead of 
multi-threaded, thereby conveniently circumventing any threading issues in 
the foreign libs.  Could the LCL support such an architecture?


Thanks!

--
Al

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

Reply via email to