[fpc-devel] Threads and alot of crap continued

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Nov 8 15:04:24 CET 2006



On Wed, 8 Nov 2006, Michael Schnell wrote:

> 
> > There is TCustomApplication in fcl/inc/custapp. The Lazarus TApplication
> > descends
> > from it. All you need to do is create a descendent of TCustomApplication
> > which
> > can implement all the messaging you wish for...
> >   
> I took a look at TCustomApplication. Same does not provide anything that is
> related to scheduling (e.g.: ProcessMessages), but everything else that
> TApplication has. Supposedly the scheduling stuff is added by Lazarus.
> 
> So the way to go is
> (1a) do the scheduling stuff based on messages in it's own object.
> (1b) do TApplication as a descendant of TCustomApplication and have it use the
> scheduling object.
> (1c) do TTimer in a way that it sends messages to the main thread.
> (1d )do TThread.Synchronize in a way that it sends messages to the main
> thread.

TThread.Synchronize does not need to be changed. You can set a series
of callbacks (from classes unit) which you can then use to configure
the whole synchronize issue...

> and later
> (2a) do TSchedThread as a descendant of TThread in a way that it uses the
> scheduling object. (it will have things like TSchedThread.Run and
> TSchedThread.ProcessMessages).
> (2b) do TTimer in a way that when used with TSchedThread it sends it's
> messages to the appropriate thread

Seems correct. And all this cross-platform, of course :-)

Michael.



More information about the fpc-devel mailing list