On Mon, 19 Jan 2009, Mindaugas Kavaliauskas wrote: Hi,
>> Same for me. It seem more ‘intuitive’ for me that each thread really >> has it’s own initial value, even when the value by itself is the same. > I agree, and I prefer even more strict behaviour here. Thread statics > should be initialized to NIL on thread startup. Because it's static of THAT > PARTICULAR thread, and its' value is not related to value of parent thread > statics. This also makes to leave cloning decision for programmer: he can > clone, or do not clone, or create new objects, typed pointers, since > cloning for them usually means nothing. > I see Przemek is already committed the change. We can leave it. The above > opinion is more "theoretical", because I have we very few MT programming > skills and I do not have a strong feeling on that should be default in > cases like this. To clarify because it's possible that people are confused by some information. The same initialization value is and always used in each thread and it data declared by user in source code (.prg). It's not inherited from parent thread and never was. The initialization to NIL is as good as to 1, .t., 0d20090119, "text", {|| "CodeBlock" }, { "A"=>"qwe" } or any other constant value. Please run harbour/tests/mt/mttest12.prg to see it. The modification I committed few hours ago changed only one thing: complex values which are not cloned by simple assignment like, f.e.: a := {} b := a // now 'a' and 'b' points to the same array (hashes and arrays in current HVM code) now are cloned so it's not possible to change original initialization value. For each thread it's always the same as declared in source code. But this is only to initialization code. If someone manually assign the same array using := operator into thread static variable in two different threads then it will not be cloned or anything like that and both threads will share the same array body. I hope that now it is more clear for every body. best regards, Przemek _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour