En/na Luca Olivetti ha escrit:
En/na Lee Jenkins ha escrit:
Hi all,
I need to build a GUI application where a spawned thread will open a
socket, receive messages and the controls on the form (TStringGride,
etc) will need to be updated with values received from the socket.
Should I use a critical section for this? I remember that Delphi has
a method for interacting with the main thread from other threads, is
this supported in Laz/FPC?
Synchronize(method) will execute method in the context of the main thread.
Mmmh, I just made an experiment (under windows, but development will
probably follow under linux): I have a communication thread in a
continuous polling loop. Each time I complete a successful
communication, I increase a label tag and change its caption to display
the counter.
If I use synchronize to call the method of the main form and move the
window around, while I'm moving the window the counter (and so I think
the thread) stops, but if I don't use synchronize I can move the window
and see the label updating, so I wonder if synchronize is really
(always) needed nowadays.
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