Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support for labeling a Venue.

  • Loading branch information...
commit b0ec63c5a1ff15ce20232dc39eca47501746b56f 1 parent ee3c5fb
@RayRacine authored
Showing with 20 additions and 14 deletions.
  1. +20 −14 venue/venue.rkt
View
34 venue/venue.rkt
@@ -21,38 +21,44 @@
if-stream-in
pump-ports))
-;; From the point of view of a user of a venue.
-;; i.e., we see a sink for msgs to a venue as input in which to 'sink' the msgs.
-(define-type Venue-Sink (U Thread (Option Input-Port)))
-(define-type Venue-Source (U Thread (Option Output-Port)))
+(define-type Venue-Sink (U Thread (Option Output-Port)))
+(define-type Venue-Source (U Thread (Option Input-Port)))
-(struct: Venue ([place : Place]
+(struct: Venue ([who : Symbol]
+ [place : Place]
[inp : Venue-Sink]
[outp : Venue-Source]
- [errp : Venue-Source]) #:transparent)
+ [errp : Venue-Source])
+ #:methods gen:custom-write [(define (write-proc venue port mode)
+ (display (format "#<Venue-~s>" (Venue-who venue)) port))]
+ #:transparent)
(define-type XVenue (U Place Place-Channel))
(define-type Venue-Channel Place-Channel)
-(: pump-place (Place Output-Port (Option Input-Port) (Option Input-Port)
- Input-Port (Option Output-Port) Output-Port ->
- (Values (U Thread (Option Output-Port))
- (U Thread (Option Input-Port))
- (U Thread (Option Input-Port)))))
+(: pump-place (Place Output-Port (Option Input-Port) (Option Input-Port)
+ (Option Input-Port) (Option Output-Port) (Option Output-Port) -> Void))
+;(Values (U Thread (Option Output-Port))
+; (U Thread (Option Input-Port))
+; (U Thread (Option Input-Port)))))
(define (pump-place p pin pout perr in out err)
(let-values ([(t-in t-out t-err) (pump-ports (RT-place-dead-evt p) pin pout perr in out err)])
- (RT-place-pumper-threads p (vector t-in t-out t-err))))
+ (let ((ths (RT-place-pumper-threads p (vector t-in t-out t-err))))
+ (void))))
(: start-venue (Symbol Module-Path Symbol
(Option Input-Port)
(Option Output-Port)
(Option Output-Port) -> Venue))
(define (start-venue who module start-fn in out err)
- (let-values (([venue pin pout perr] (RT-dynamic-place module start-fn
+ (let-values (([place pin pout perr] (RT-dynamic-place module start-fn
(if-stream-in who in)
(if-stream-out who out)
(if-stream-out who err))))
- (Venue venue
+
+ (pump-place place pin pout perr in out err)
+
+ (Venue who place
(and (not in) pin)
(and (not out) pout)
(and (not err) perr))))
Please sign in to comment.
Something went wrong with that request. Please try again.