Código: Selecionar todos
PROCEDURE Main
LOCAL oThread := Thread():new() // create thread object
CLS
oThread:start( "Sum", 10000 ) // sum numbers from 1
// to 10000
DO WHILE .T. // display characters during
?? "." // the calculation
Sleep(10)
IF ! oThread:active // Check if thread still runs
EXIT
ENDIF
ENDDO
? "The sum is:", oThread:result
RETURN
FUNCTION Sum( nNumber )
LOCAL i, nSum := 0
FOR i:=1 TO nNumber
nSum += i
IF i % 100 == 0 // progress display
DispOutAt( MaxRow(), 0, i )
ENDIF
NEXT
RETURN nSum

