source: project/release/5/mailbox/trunk/tests/mailbox-primordial-test.scm @ 36196

Last change on this file since 36196 was 36196, checked in by Kon Lovett, 14 months ago

wank test

File size: 992 bytes
Line 
1;from caolan
2
3(import (chicken condition) (srfi 18) mailbox)
4
5;;
6
7(define (ensure-conditions-as-list exn)
8  (or
9    (and (condition? exn) (condition->list exn))
10    exn) )
11
12;;
13
14(print)
15(print "** Test Primordial Waiting **")
16
17;;
18
19(define mbox (make-mailbox 'example))
20
21(define *primordial-thread* ##sys#primordial-thread #;(current-thread))
22
23;;
24
25(define (test-thread)
26  (thread-sleep! 1)
27  (thread-signal! *primordial-thread* 'example) )
28
29(define test-thread-1 (thread-start! test-thread))
30
31;;
32
33#; ;this hangs forever and eats all my cycles (with timeout)
34(handle-exceptions exn
35  (print "+ wait with timeout NOT OK for primordial thread: " (ensure-conditions-as-list exn))
36  (mailbox-receive! mbox 4) )
37
38;this exits as expected with the 'example exception (no timeout)
39(handle-exceptions exn
40  (print "+ wait without timeout OK for primordial thread: " (ensure-conditions-as-list exn))
41  (mailbox-receive! mbox) )
42
43;;
44
45(print "** Tested Primordial Waiting **")
46
47(thread-join! test-thread-1)
Note: See TracBrowser for help on using the repository browser.