source: project/release/5/synch/tags/3.3.0/tests/critical-region-test.scm @ 38609

Last change on this file since 38609 was 38609, checked in by Kon Lovett, 3 months ago

rel 3.3.0

File size: 873 bytes
Line 
1;;;; critical-region-test.scm  -*- Scheme -*-
2;;;; Kon Lovett, Dec '18
3
4(import test)
5
6(test-begin "Critical Region")
7
8;;;
9
10(import critical-region)
11
12(test-group "Exchanger"
13  (let ((xr (make-exchanger #f)))
14    (test-assert (procedure? xr))
15    (test #f (xr #t))
16    (test #t (xr 4)) )
17)
18
19#;
20(test-group "Critical Region"
21  (test-assert "disabled" (critical-region (not (interrupts-enabled?))))
22  (test-assert "enabled" (interrupts-enabled?))
23  (test-assert (not (receive (f v) (critical-region* (abort 'foo)) f)))
24  (test-assert "enabled" (interrupts-enabled?))
25  (test-assert "apply disabled"  (critical-region-apply (lambda (_) (not (interrupts-enabled?))) #f))
26  (test 'expected (critical-region-apply (lambda (x) x) 'expected))
27  (test-assert (not (receive (f v) (critical-region-call* (lambda () (abort 'foo))) f)))
28)
29
30;;;
31
32(test-end "Critical Region")
33
34(test-exit)
Note: See TracBrowser for help on using the repository browser.