thread & io: code clean-ups
Remove unused `require`s and fix some indentation.
This commit is contained in:
parent
82b5ec8d18
commit
dffcbc1cb2
|
@ -433,14 +433,14 @@
|
|||
(or stderr-logging-arg
|
||||
(let ([spec (getenv "PLTSTDERR")])
|
||||
(if spec
|
||||
(parse-logging-spec spec "in PLTSTDERR environment variable" #f)
|
||||
(parse-logging-spec "stderr" spec "in PLTSTDERR environment variable" #f)
|
||||
'(error)))))
|
||||
|
||||
(define stdout-logging
|
||||
(or stdout-logging-arg
|
||||
(let ([spec (getenv "PLTSTDOUT")])
|
||||
(if spec
|
||||
(parse-logging-spec spec "in PLTSTDOUT environment variable" #f)
|
||||
(parse-logging-spec "stdout" spec "in PLTSTDOUT environment variable" #f)
|
||||
'()))))
|
||||
|
||||
(when (getenv "PLT_STATS_ON_BREAK")
|
||||
|
|
|
@ -13,21 +13,21 @@
|
|||
->path)
|
||||
|
||||
(struct path (bytes convention)
|
||||
#:property prop:custom-write
|
||||
(lambda (p port mode)
|
||||
(when mode
|
||||
(write-string "#<path:" port))
|
||||
(write-string (bytes->string/locale (path-bytes p)) port)
|
||||
(when mode
|
||||
(write-string ">" port)))
|
||||
#:property prop:equal+hash
|
||||
(list
|
||||
(lambda (p1 p2 eql?)
|
||||
(eql? (path-bytes p1) (path-bytes p2)))
|
||||
(lambda (p hc)
|
||||
(hc (path-bytes p)))
|
||||
(lambda (p hc)
|
||||
(hc (path-bytes p)))))
|
||||
#:property prop:custom-write
|
||||
(lambda (p port mode)
|
||||
(when mode
|
||||
(write-string "#<path:" port))
|
||||
(write-string (bytes->string/locale (path-bytes p)) port)
|
||||
(when mode
|
||||
(write-string ">" port)))
|
||||
#:property prop:equal+hash
|
||||
(list
|
||||
(lambda (p1 p2 eql?)
|
||||
(eql? (path-bytes p1) (path-bytes p2)))
|
||||
(lambda (p hc)
|
||||
(hc (path-bytes p)))
|
||||
(lambda (p hc)
|
||||
(hc (path-bytes p)))))
|
||||
|
||||
(define is-path?
|
||||
(let ([path? (lambda (p)
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#lang racket/base
|
||||
(require "../common/check.rkt"
|
||||
"../host/thread.rkt"
|
||||
"parameter.rkt"
|
||||
"read-and-peek.rkt"
|
||||
"input-port.rkt"
|
||||
"count.rkt"
|
||||
"progress-evt.rkt"
|
||||
"flush-output.rkt")
|
||||
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
(require "../common/check.rkt"
|
||||
"../host/thread.rkt"
|
||||
"input-port.rkt"
|
||||
"output-port.rkt"
|
||||
"custom-port.rkt"
|
||||
"pipe.rkt"
|
||||
"peek-via-read-port.rkt"
|
||||
"buffer-mode.rkt")
|
||||
"peek-via-read-port.rkt")
|
||||
|
||||
(provide make-input-port)
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"../host/thread.rkt"
|
||||
"parameter.rkt"
|
||||
"read-and-peek.rkt"
|
||||
"port.rkt"
|
||||
"input-port.rkt"
|
||||
(submod "bytes-input.rkt" internal)
|
||||
"../string/utf-8-decode.rkt"
|
||||
|
|
|
@ -26,20 +26,20 @@
|
|||
|
||||
(struct channel (get-queue
|
||||
put-queue)
|
||||
#:property
|
||||
prop:evt
|
||||
(poller (lambda (ch poll-ctx)
|
||||
(channel-get/poll ch poll-ctx))))
|
||||
#:property
|
||||
prop:evt
|
||||
(poller (lambda (ch poll-ctx)
|
||||
(channel-get/poll ch poll-ctx))))
|
||||
|
||||
(struct channel-put-evt* (ch v)
|
||||
#:property
|
||||
prop:evt
|
||||
(poller (lambda (cp poll-ctx)
|
||||
(channel-put/poll (channel-put-evt*-ch cp)
|
||||
(channel-put-evt*-v cp)
|
||||
cp
|
||||
poll-ctx)))
|
||||
#:reflection-name 'channel-put-evt)
|
||||
#:property
|
||||
prop:evt
|
||||
(poller (lambda (cp poll-ctx)
|
||||
(channel-put/poll (channel-put-evt*-ch cp)
|
||||
(channel-put-evt*-v cp)
|
||||
cp
|
||||
poll-ctx)))
|
||||
#:reflection-name 'channel-put-evt)
|
||||
|
||||
;; A channel must not match get and put from the same thread, which is
|
||||
;; a danger when `sync` queues up multiple events at a time:
|
||||
|
@ -209,6 +209,7 @@
|
|||
(define (set-sync-on-channel! sync)
|
||||
(set! sync-on-channel sync))
|
||||
|
||||
;;
|
||||
;; ----------------------------------------
|
||||
|
||||
(define-values (impersonator-prop:channel-put channel-put-impersonator? channel-put-impersonator-ref)
|
||||
(make-impersonator-property 'channel-put-impersonator))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#lang racket/base
|
||||
(require racket/unsafe/ops
|
||||
"atomic.rkt")
|
||||
(require "atomic.rkt")
|
||||
|
||||
(provide prop:evt
|
||||
evt?
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
(struct plumber (callbacks ; hash table of handles -> callbacks
|
||||
weak-callbacks) ; same, but weak references
|
||||
#:property prop:authentic #t)
|
||||
#:authentic)
|
||||
|
||||
(define (make-plumber)
|
||||
(plumber (make-hasheq)
|
||||
|
|
|
@ -24,19 +24,19 @@
|
|||
|
||||
(struct semaphore ([count #:mutable]
|
||||
queue)
|
||||
#:property
|
||||
prop:evt
|
||||
(poller (lambda (s poll-ctx)
|
||||
(semaphore-wait/poll s poll-ctx))))
|
||||
#:property
|
||||
prop:evt
|
||||
(poller (lambda (s poll-ctx)
|
||||
(semaphore-wait/poll s poll-ctx))))
|
||||
|
||||
(struct semaphore-peek-evt (sema)
|
||||
#:property
|
||||
prop:evt
|
||||
(poller (lambda (sp poll-ctx)
|
||||
(semaphore-wait/poll (semaphore-peek-evt-sema sp)
|
||||
poll-ctx
|
||||
#:peek? #t
|
||||
#:result sp))))
|
||||
#:property
|
||||
prop:evt
|
||||
(poller (lambda (sp poll-ctx)
|
||||
(semaphore-wait/poll (semaphore-peek-evt-sema sp)
|
||||
poll-ctx
|
||||
#:peek? #t
|
||||
#:result sp))))
|
||||
|
||||
(struct semaphore-peek-select-waiter select-waiter ())
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
(submod "channel.rkt" for-sync)
|
||||
"thread.rkt"
|
||||
(only-in (submod "thread.rkt" scheduling)
|
||||
current-break-enabled-cell
|
||||
thread-descheduled?)
|
||||
"schedule-info.rkt")
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#lang racket/base
|
||||
(require "evt.rkt"
|
||||
"semaphore.rkt"
|
||||
"internal-error.rkt")
|
||||
"semaphore.rkt")
|
||||
|
||||
(provide (rename-out [get-system-idle-evt system-idle-evt])
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#lang racket/base
|
||||
(require "engine.rkt"
|
||||
"check.rkt"
|
||||
(require "check.rkt"
|
||||
"internal-error.rkt"
|
||||
"atomic.rkt")
|
||||
|
||||
|
|
|
@ -117,12 +117,12 @@
|
|||
[cpu-time #:mutable] ; accumulates CPU time in milliseconds
|
||||
|
||||
[condition-wakeup #:mutable])
|
||||
#:property prop:waiter
|
||||
(make-waiter-methods
|
||||
#:suspend! (lambda (t i-cb r-cb) (thread-deschedule! t #f i-cb r-cb))
|
||||
#:resume! (lambda (t v) (thread-reschedule! t) v))
|
||||
#:property prop:evt (lambda (t) (wrap-evt (get-thread-dead-evt t)
|
||||
(lambda (v) t))))
|
||||
#:property prop:waiter
|
||||
(make-waiter-methods
|
||||
#:suspend! (lambda (t i-cb r-cb) (thread-deschedule! t #f i-cb r-cb))
|
||||
#:resume! (lambda (t v) (thread-reschedule! t) v))
|
||||
#:property prop:evt (lambda (t) (wrap-evt (get-thread-dead-evt t)
|
||||
(lambda (v) t))))
|
||||
|
||||
(define root-thread #f)
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
;; Used for semaphores and channels to run a "just selected" callback
|
||||
;; when synchronized:
|
||||
(struct select-waiter (proc)
|
||||
#:property prop:waiter
|
||||
(make-waiter-methods #:suspend! (lambda args (internal-error "should not suspend a select-waiter"))
|
||||
#:resume! (lambda (w s)
|
||||
((select-waiter-proc w)))))
|
||||
#:property prop:waiter
|
||||
(make-waiter-methods #:suspend! (lambda args (internal-error "should not suspend a select-waiter"))
|
||||
#:resume! (lambda (w s)
|
||||
((select-waiter-proc w)))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user