From b7e6df9c833b74c9104452978fbdd9fb33988a9b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 11 May 2004 16:16:15 +0000 Subject: [PATCH] . original commit: 65414279cfb1157b248fe75cfbc6ae06228df856 --- collects/mzlib/async-channel.ss | 10 +++++----- collects/mzlib/cml.ss | 11 ++++++++--- collects/mzlib/transcr.ss | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/collects/mzlib/async-channel.ss b/collects/mzlib/async-channel.ss index 56b9f88..e0cb56f 100644 --- a/collects/mzlib/async-channel.ss +++ b/collects/mzlib/async-channel.ss @@ -41,7 +41,7 @@ (channel-put-evt empty-ch (make-semaphore))] ; see poll->ch [tell-full (channel-put-evt full-ch (make-semaphore))] ; see poll->ch - [enqueue (wrap-evt + [enqueue (convert-evt enqueue-ch (lambda (v) ;; We received a put; enqueue it: @@ -51,7 +51,7 @@ (set! queue-last p))))] [mk-dequeue (lambda () - (wrap-evt + (convert-evt (channel-put-evt dequeue-ch (car queue-first)) (lambda (ignored) ;; A get succeeded; dequeue it: @@ -106,7 +106,7 @@ ;; Put ---------------------------------------- (define (async-channel-put-evt ac v) - (letrec ([p (wrap-evt + (letrec ([p (convert-evt (guard-evt (lambda () ;; Make sure queue manager is running: @@ -133,11 +133,11 @@ ;; If a value becomes available, ;; create a waitable that returns ;; the value: - (wrap-evt + (convert-evt normal (lambda (v) ;; Return a waitable for a successful poll: - (wrap-evt + (convert-evt always-evt (lambda (ignored) v)))) ;; If not-ready becomes available, diff --git a/collects/mzlib/cml.ss b/collects/mzlib/cml.ss index c983d2c..371cc8b 100644 --- a/collects/mzlib/cml.ss +++ b/collects/mzlib/cml.ss @@ -12,24 +12,29 @@ ch) (define (channel-send-evt ch v) - (make-wrapped-waitable - (make-channel-put-waitable ch v) + (convert-evt + (channel-put-evt ch v) void)) (define (thread-done-evt th) - (thread-dead-waitable th)) + (thread-dead-evt th)) (define (current-time) (current-inexact-milliseconds)) (define (time-evt t) (alarm-evt t)) + (define (wrap-evt e p) + (convert-evt e p)) + (provide/contract (spawn ((-> any) . -> . thread?)) (channel (-> channel?)) (channel-recv-evt (channel? . -> . evt?)) (channel-send-evt (channel? any? . -> . evt?)) + (wrap-evt (evt? (any? . -> . any) . -> . evt?)) + (thread-done-evt (thread? . -> . evt?)) (current-time (-> number?)) (time-evt (real? . -> . evt?)))) diff --git a/collects/mzlib/transcr.ss b/collects/mzlib/transcr.ss index 6bfaa32..f9ca994 100644 --- a/collects/mzlib/transcr.ss +++ b/collects/mzlib/transcr.ss @@ -1,6 +1,6 @@ (module transcr mzscheme - (require (lib "thread.ss")) + (require (lib "port.ss")) (provide (rename -transcript-on transcript-on) (rename -transcript-off transcript-off))