Files
harbour-core/tests/mt/mttest12.prg
vszakats 306fdd0446 2013-03-15 18:27 UTC+0100 Viktor Szakats (harbour syenar.net)
* package/*
  * src/compiler/harbour.y
  * src/compiler/harbour.yyc
  * src/macro/macro.y
  * src/macro/macro.yyc
  * src/pp/hbpp.1
  * tests/*/*
  * utils/*
    * stripped svn header manually

  * tests/hbdocext.hb
  * tests/lang2po.hb
  * tests/big5_gen.prg
  * tests/uc16_gen.prg
    * do not add svn ids to generated sources

  + tests/stripsvn.hb
    + added script to strip svn header from sources
2013-03-15 18:30:08 +01:00

44 lines
999 B
Plaintext

/*
* Harbour Project source code:
* demonstration/test code for thread static variables
*
* Copyright 2009 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://harbour-project.org
*
*/
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