[fpc-pascal] How to initialize thread vars?

"Vinzent Höfler" JeLlyFish.software at gmx.net
Thu Sep 4 13:02:56 CEST 2008


suppose I need some threadvars inside dynamically allocated objects to keep track of the number of calls to certain methods. Basic requirement is to keep track of recursive calls per thread, so I tried implementing that with thread vars. Only problem: How do I initialize them? I can't do it from within the constructor, because it most probably runs in a different context. I can't do it from within the object itself, because any flag indicating that the thread vars are initialized would itself be required to be a thread var...

The only "clean" solution to me seems to hook the BeginThread routine of the thread manager, but I don't like that approach too much...

Perhaps someone has a smarter idea?


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

More information about the fpc-pascal mailing list