+1 for handling them separately. (reasons: more coherent/expected
behaviour, quicker and more compact code, since inline initialization can
be used without
concerns. It's a light reasoning after doing a quick scan on my source and
spotting
quite some places where current behaviour is a potential problem.)

Brgds,
VIktor

On Mon, Jan 19, 2009 at 7:58 PM, Przemyslaw Czerpak <dru...@acn.waw.pl>wrote:

> On Mon, 19 Jan 2009, Lorenzo Fiorini wrote:
>
> Hi Lorenzo,
>
> > For example I have a static array that keeps the menu prompts. At the
> > start the menus are correct since every "module" has its own own
> > prompts but if I choose an entry in one app I get that entry disabled
> > in another app or not disabled at all.
> > If I launch the same app with a parameter that start only one thread
> > at time it works as expected.
> > Surely I'm missing sth or I am misunderstood how the "thread static"
> works.
> > Any suggestion?
>
> Probably you are asking about the same thing as Pritpal was few weeks
> ago. Should we clone or simply copy thread static initial value.
> Now it's copied so the behavior is the same as for:
>
>   proc main()
>      local a:={}
>      ? len(a)
>      p(a)
>      ? len(a)
>   return
>   proc p(x)
>      aadd(x,0)
>   return
>
> Please note that p() changes the body of 'a' because 'a' and 'x'
> local variables shares the same array body.
> The same happens now for thread static variables initial value.
> Each thread has its own thread static variable but they share
> initialization data when it's complex item (hash or array) so
> when you modify them in one thread in other modifications are
> visible. If you want to eliminate this behavior you should
> initialize the variable from source code, f.e.:
>   if s_var == NIL
>      s_var := {}
>   endif
> anyhow it's still open the question about Harbour default behavior.
> I can change it and instead of copping initialization data to thread
> static variable I can clone it. In other words the original initialization
> value will be always kept in hidden HVM structures and cloned when each
> thread access it 1-st time. Such modification will effect only hashes
> and array values. All other types will be unchanged.
> Seems that you are the second person confused by current behavior and
> probably not the last one and this is important argument for me to
> think about changing it.
> What's the group opinion about it?
>
> best regards,
> Przemek
> _______________________________________________
> Harbour mailing list
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour
>
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to