factor/library/test/threads.factor

23 lines
489 B
Factor
Raw Normal View History

IN: temporary
USE: namespaces
USE: io
USE: test
USE: threads
USE: errors
! This only tests co-operative threads in CFactor.
! It won't give intended results in Java (or in CFactor if
! we ever get preemptive threads).
3 "x" set
[ yield 2 "x" set ] in-thread
[ 2 ] [ yield "x" get ] unit-test
2004-08-23 20:44:58 -04:00
[ ] [ [ flush ] in-thread flush ] unit-test
[ ] [ [ "Errors, errors" throw ] in-thread ] unit-test
2004-11-25 23:14:17 -05:00
yield
2006-08-18 00:03:45 -04:00
[ ] [ 1/2 sleep ] unit-test
[ ] [ 0.3 sleep ] unit-test
[ "hey" sleep ] unit-test-fails