Files
harbour-core/tests/mt/mttest02.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

66 lines
1.3 KiB
Plaintext

/*
* Harbour Project source code:
* demonstration/test code for using QUIT commands and ALWAYS statements
* execution. Child thread uses QUIT before main one.
*
* Copyright 2008 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://harbour-project.org
*
*/
#ifdef __XHARBOUR__
#xtranslate hb_threadStart( <x,...> ) => StartThread( <x> )
#xtranslate hb_threadJoin( <x,...> ) => JoinThread( <x> )
#command begin sequence => try
#command always => finally
#endif
proc main()
local thID, i
? Version()
? "Main start"
thID := hb_threadStart( @thFunc(), "A", "B", "C" )
? "Thread ID:", thID
? "==================="
?
begin sequence
for i := 1 to 10
?? "M"
hb_idleSleep( 0.050 )
next
? "==================="
? "Main QUIT"
quit
always
? "Main ALWAYS section"
?
endsequence
? "End of main"
return
proc thFunc( ... )
local i
? "Thread begin"
? "Parameters:"
aeval( hb_aParams(), {| x | qqout( "", x ) } )
?
begin sequence
for i := 1 to 10
?? "t"
hb_idleSleep( 0.030 )
if i == 5
? "Thread QUIT"
quit
endif
next
always
? "Thread ALWAYS section"
?
endsequence
? "Thread end"
?
return
exit proc p
? "I'm EXIT procedure"