On Sun, 31 May 2009 01:50:19 +1000 SteveG <[email protected]> wrote:
> On Saturday 30 May 2009 17:09:41 Mattias Gaertner wrote: > > On Sat, 30 May 2009 12:55:14 +1000 > > > > SteveG <[email protected]> wrote: > > > Would appreciate anybody clearing this up for me - > > > > > > If I use a TTimer on a GUI form to call a function, is the > > > function within the Main thread at all times (therefore gui > > > threadsafe) ? > > > > yes > > > > > If the above function then calls a function within a library, is > > > the call still within the main thread (still safe) ? > > > > Yes. > > Unless the library starts another thread. > > One further assumption (to save a little time) - > If a TTimer is created within the 'Initialization' section of the Laz > app, and the timer event calls a function within a library, all calls > within that function, and any functions it calls should be thread/gui > safe ? The TTimer events are called by the main gui thread. I don't know if this fits your thread safety definition. > Assuming the above to be true, can you tell me why the following > 'sometimes' fails (works about 3 of 5 calls) when used from within > the library function? > > I pass the address of a WinCtrl (eg Label) to the function, then use > the following > TLabel( CompAddress^ ).Caption := 'test'; > > also a problem is 'Application.ProcessMessages' within the library > > These (and variations of) seem to fail regularly, but work fine from > the Laz app itself I can't say without knowing the code. Please provide an example. Mattias _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
