Ticket #2116: stdout3.AU3

File stdout3.AU3, 772 bytes (added by davegrave@…, 13 years ago)

stdout3.au3 (has to be compiled)

Line 
1$threadident = $cmdline[1]
2
3ConsoleWrite("thread started " & $threadident & @CRLF)
4
5do
6        Sleep(100)
7until StringInStr(ConsoleRead(),"start work")
8
9worktodo()
10ConsoleWrite("work done " & $threadident & @CRLF)
11
12do
13        Sleep(100)
14until StringInStr(ConsoleRead(),"exit")
15
16ConsoleWrite("exited by master " & $threadident & @CRLF)
17Sleep(1000)
18Exit
19
20
21Func worktodo()
22        SRandom(timerinit())
23        Local $ergebnis=0
24        for $i=1 to 10
25                Sleep(1000)
26                $ergebnis += $i* $ergebnis + random(1000,9999,1)
27                ;$ergebnis += $i* $ergebnis + _random() ; resolves issue
28                consolewrite("I am working (" & $ergebnis & ")! " & $threadident & @CRLF)
29        Next
30EndFunc
31
32func _random()
33        Local $random = 1
34        $random = Random($threadident,$threadident*2000,1)
35        Return $random
36EndFunc