[fpc-pascal] Re: How to initialize thread vars?
JeLlyFish.software at gmx.net
Thu Sep 4 14:57:48 CEST 2008
> I think that thread variables are automatically initialized to zero. So
> you just need to use them in such a way that zero is the desired start
Hmm, yes. I just checked the sourcecode and indeed, for Win32 and Unix at least the threadvars are indeed initialized to zero. That would fit nicely here. ;)
If any of the developers could confirm, whether this is guaranteed semantics or was just a sane choice by the implementor? Because the documentation reads quite a bit differently:
"Note that the copy is made with the original value of the variable, not with the value of the variable at the time the thread is started."
Which doesn't make too much sense to me considering that I can't initialize thread vars at all (compiler complains: 'Cannot initialize variables declared as threadvar'). So what would this "original value" be (besides the obvious zero - which is the default value for all global variables)?
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
More information about the fpc-pascal