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

Last change on this file since 39700 was 39700, checked in by Kon Lovett, 2 months ago

new test runner, remove "primitives", stop variant `check-' proc gen, fix record printers

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