(import synch-dynexn) (define mx1 (make-mutex 'mx1)) (when DO-GENNY (let ((genny (count-to-coroutine 5)) (end-state #f)) (threads-begin (test-group "Synch Genny" (synch mx1 (let loop ((i (genny))) ;(gloss "mx1" (mutex-state mx1)) (test-assert "locked" (not (eq? 'not-abandoned (mutex-state mx1)))) (unless (eof-object? i) (set! end-state i) (thread-yield!) (loop (genny)) ) ) ) (test "ran to end" 4 end-state) ;(gloss "mx1" (mutex-state mx1)) (test "unlocked" 'not-abandoned (mutex-state mx1)) ) ) ) ) (when DO-DYNCTX (let ((iter (count-to-iteration 5)) (end-state #f)) (threads-begin (test-group "Synch Dynamic Context (Early Exit Handler Call)" (synch mx1 (iter (lambda (state) ;(gloss "mx1" (mutex-state mx1)) (test-assert "unlocked (Way Too Early)" (eq? 'not-abandoned (mutex-state mx1))) (thread-yield!) (set! end-state state) ) ) ) (test "ran to end" 4 end-state) ;(gloss "mx1" (mutex-state mx1)) (test "unlocked" 'not-abandoned (mutex-state mx1)) ) ) ) ) ;; ;#; (let ((genny (count-to-coroutine 5)) (end-state #f)) (threads-begin (test-group "Genny" (let loop ((i (genny))) (unless (eof-object? i) (set! end-state i) (thread-yield!) (loop (genny)) ) ) (test "ran to end" 4 end-state) ) ) ) ;#; (let ((iter (count-to-iteration 5)) (end-state #f)) (threads-begin (test-group "Dynamic Context" (iter (lambda (state) (thread-yield!) (set! end-state state))) (test "ran to end" 4 end-state) ) ) )