tidied up, removed some unused definitions
This commit is contained in:
parent
a0fbba4a81
commit
2c8407d195
@ -1,8 +1,6 @@
|
|||||||
#lang racket
|
#lang racket
|
||||||
(require math/base) ;; for random number generation
|
(require math/base) ;; for random number generation
|
||||||
|
|
||||||
;; TODO wrap "safer send in a function that takes care of semaphores"
|
|
||||||
|
|
||||||
;; globals
|
;; globals
|
||||||
; track number of connections with closure
|
; track number of connections with closure
|
||||||
(define (make-count no-count)
|
(define (make-count no-count)
|
||||||
@ -20,6 +18,7 @@
|
|||||||
[(eq? m 'current-count) current-count]))
|
[(eq? m 'current-count) current-count]))
|
||||||
dispatch)
|
dispatch)
|
||||||
(define c-count (make-count 0))
|
(define c-count (make-count 0))
|
||||||
|
; a semaphore to control access to c-count
|
||||||
(define c-count-s (make-semaphore 1))
|
(define c-count-s (make-semaphore 1))
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +37,7 @@
|
|||||||
[(eq? m 'add) add]))
|
[(eq? m 'add) add]))
|
||||||
dispatch)
|
dispatch)
|
||||||
(define c-connections (make-connections '()))
|
(define c-connections (make-connections '()))
|
||||||
|
; a semaphore to control acess to c-connections
|
||||||
(define connections-s (make-semaphore 1)) ;; control access to connections
|
(define connections-s (make-semaphore 1)) ;; control access to connections
|
||||||
|
|
||||||
;; every 5 seconds run to broadcast top message in list
|
;; every 5 seconds run to broadcast top message in list
|
||||||
@ -46,10 +45,6 @@
|
|||||||
(define messages-s (make-semaphore 1)) ;; control access to messages
|
(define messages-s (make-semaphore 1)) ;; control access to messages
|
||||||
(define messages '()) ;; stores a list of messages(strings) from currents
|
(define messages '()) ;; stores a list of messages(strings) from currents
|
||||||
|
|
||||||
(define threads-s (make-semaphore 1)) ;; control access to threads
|
|
||||||
;; lets keep thread descriptor values
|
|
||||||
(define threads '()) ;; stores a list of client serving threads as thread descriptor values
|
|
||||||
|
|
||||||
;; Several threads may want to print to stdout, so lets make things civil
|
;; Several threads may want to print to stdout, so lets make things civil
|
||||||
(define stdout (make-semaphore 1))
|
(define stdout (make-semaphore 1))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user