Page 1 of 1

Thread Example

PostPosted: Mon Feb 11, 2008 2:31 pm
by Charles
Okay, it's a silly example, but it shows another use of "ref" for referring to methods instead of invoking them:
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