use System.Threading
class ThreadTest
shared
var _maxSeconds = 2.1f
var _start as DateTime
def main
_start = DateTime.now
t = Thread(ref .writeY)
t.start
while not .isFinished
print 'a' stop
t.join
print
print 'Finished.'
def writeY
while not .isFinished
print 'b' stop
get isFinished as bool
return DateTime.now.subtract(_start).totalSeconds >= _maxSeconds
Forums
Thread Example
1 post
• Page 1 of 1
Thread Example
Okay, it's a silly example, but it shows another use of "ref" for referring to methods instead of invoking them:
- Charles
- Posts: 2515
- Location: Los Angeles, CA
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 26 guests