On Tue, 21 Dec 2010 14:29:36 +0100 (CET) michael.vancann...@wisa.be wrote: > > > On Tue, 21 Dec 2010, Mattias Gaertner wrote: > > > Hi, > > > > How to get the current TThread instance? > > There is no documented method.
Strange. Am I really the first needing this? > > For example: I created a TThread and called a function, which calls a > > function .... One of those sub functions needs to call > > TThread.Synchronize, which needs as parameter the current TThread. > > Pass on the TThread instance. You mean as parameter? Some functions are predefined events. That means I call them and they call me back. I would like to avoid adding everywhere another parameter. > You could use GetCurrentThreadID and a lookup list. What about using a threadvar CurrentThread: Thread; ? TThread could set this in the constructor. BTW, you can call Synchronize for another thread than the current. Is that allowed? Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal