[fpc-devel] Threads and alot of crap continued
mschnell at lumino.de
Wed Nov 8 10:15:37 CET 2006
> As for general use, you can't do a Timer this way.
Right ! The beauty of TTimer (and GUI events as well) is that it does
not work in a thread. Otherwise it e.g. would not be possible to do GUI
stuff in a timer event, as VCL and LCL are not thread save (and probably
can't be made thread save).
> In case of gui TTimer this cannot happen because it's not threaded, so
> the userloop would first finish, then the user function returns and the
> main gui loop does it's stuff (this is my oh-so-complicated part, done
> by the gui).
But that does not mean that you can't implement a decent (firing
main-thread-events) TTimer in a non-GUI way, not using the GUI API of
the system. e.g. You can use System 5 message queues to do the
scheduling and use a thread that sends messages to the main thread as a
More information about the fpc-devel