* *
% remove brandings and homepage [1] from copyright header. Pass 1 - using script.
[1] nobody has access to it anymore AFAIK - and it's also just
a redirect since long
! update url in copyright header
; this should make the diff between 3.4 and 3.2 easier to manage
42 lines
928 B
Plaintext
42 lines
928 B
Plaintext
/*
|
|
* demonstration/test code for thread static variables
|
|
*
|
|
* Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
|
|
*
|
|
*/
|
|
|
|
thread static t_var1 := { "A", "B", "C" }
|
|
thread static t_var2 := { "A" => "qwe", "B" => "asd" }
|
|
thread static t_var3 := 1235.567
|
|
thread static t_var4 := "text"
|
|
|
|
proc main()
|
|
testvar("initial main thread values")
|
|
aadd( t_var1, "X" )
|
|
t_var2[ "X" ] := "zxc"
|
|
t_var3 += 100000
|
|
t_var4 := upper( t_var4 )
|
|
testvar("modified main thread values")
|
|
hb_threadJoin( hb_threadStart( @thFunc() ) )
|
|
testvar("modified main thread values")
|
|
return
|
|
|
|
proc testvar( cMsg )
|
|
? cMsg
|
|
? "t_var1:", hb_valtoExp( t_var1 )
|
|
? "t_var2:", hb_valtoExp( t_var2 )
|
|
? "t_var3:", hb_valtoExp( t_var3 )
|
|
? "t_var4:", hb_valtoExp( t_var4 )
|
|
wait
|
|
?
|
|
return
|
|
|
|
proc thFunc()
|
|
testvar("initial child thread values")
|
|
aadd( t_var1, "Y" )
|
|
t_var2[ "Y" ] := "abc"
|
|
t_var3 -= 500000
|
|
t_var4 += " CHANGED"
|
|
testvar("modified child thread values")
|
|
return
|