Antonio Fortuny schrieb:

5. all useful code a thread needs should be encapsultated into a TObject descendant and instantiated within the thread's space.

This can all be implemented in the derived TThread class.
So, building an object around this utility code does not enlarge thread safety ?

Not really. Thread safe code must not access global variables, neither directly nor indirectly in called subroutines. The latter cannot be assured by wrapping the code in a class. See also:

6. all methods defined in the thread's definition, aprat from the EXECUTE procedure (obvious !), run into the thread creator space (the one which instantiates the thread, aka does something like wThread := TMyThread.Create (False) )

Every procedure or method runs in the context of its *caller*. Everything called from the thread's Execute method executes in the thread context (stack, threadvars).
Sounds very clear. Big idea using few words. I appeciate.

:-)

DoDi


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to