]> gitweb.factorcode.org Git - factor.git/blob - core/test/threads.factor
f3c60b28ba6b974b415d1c8ed223b2fc4e1745b5
[factor.git] / core / test / threads.factor
1 IN: temporary
2
3 USE: namespaces
4 USE: io
5 USE: test
6 USE: threads
7 USE: errors
8
9 ! This only tests co-operative threads in CFactor.
10 ! It won't give intended results in Java (or in CFactor if
11 ! we ever get preemptive threads).
12
13 3 "x" set
14 [ yield 2 "x" set ] in-thread
15 [ 2 ] [ yield "x" get ] unit-test
16 [ ] [ [ flush ] in-thread flush ] unit-test
17 [ ] [ [ "Errors, errors" throw ] in-thread ] unit-test
18 yield
19
20 [ ] [ 1/2 sleep ] unit-test
21 [ ] [ 0.3 sleep ] unit-test
22 [ "hey" sleep ] unit-test-fails