-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy paththreading.tem
26 lines (26 loc) · 1.01 KB
/
threading.tem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(page "Threading"
(import "docs/thread0.html")
(newtable "Threading"
(mac thread "[body ...]" "Creates and returns a new thread, which will last until the body terminates."
(tests (thread (+ 1 2) (+ 3 4))
(type (thread (+ 1 2))))
)
(op new-thread "procedure" "Creates and returns a new thread, which will last until <code>procedure</code>terminates. This was called <code>thread</code> in arc0."
(tests (new-thread (fn () (+ 1 2)))
))
(op break-thread "thread" "Triggers a break exception on a thread."
(faketest
"(let th (thread (sleep 2))
(break-thread th))" "user break"))
(op kill-thread "thread" "Terminates the specified thread immediately."
(tests "(let th (thread (sleep 100))
(kill-thread th)
(dead th))"))
(op sleep "secs" "Causes the current thread to sleep for at least the
specified time." (tests (sleep .1)))
(op predicate dead "thread" "Predicate to test if a thread has terminated."
(tests
"(let th (thread (sleep 1))
(prn (dead th)) (sleep 2) (prn (dead th)))"))
)
)