Remove STEAL-CHANNEL-PORT! which has been unused for a while now and

uncomfortably shared code with STEAL-PORT!
This commit is contained in:
sperber 2002-02-28 08:28:32 +00:00
parent fd54fde444
commit f5d853712b
2 changed files with 0 additions and 54 deletions

View File

@ -520,7 +520,6 @@
initialize-channel-i/o! ;scheduler
waiting-for-i/o? ;scheduler
steal-channel-port! ;command
steal-channel! ;JMG: 3 For scsh.
steal-port!
channel-cell-ref

View File

@ -187,56 +187,3 @@
(force-output-if-open port)))
(periodically-flushed-ports)))
;----------------
; The following is used to make the REPL's input, output, and error ports
; available after a keyboard interrupt. If PORT is a locked channel port
; we save the its state and then reinitialize it. The OS is told to
; abort any pending operation on the port's channel. Finally, the owning
; thread's continuation is munged to restore the port when the thread
; resumes. Any buffered input is thrown away at that point (it could
; be saved away with the channel).
;
; If the port is locked by us or one of our ancestors there is no point in
; trying to grab it.
(define (steal-channel-port! port)
(if (port->channel port)
(begin
(disable-interrupts!)
(let ((owner (if (lock-owner-uid (port-lock port))
(thread-uid->thread (lock-owner-uid (port-lock port)))
#f)))
(if (and owner
(not (running? owner)))
(really-steal-channel-port! port owner))
(enable-interrupts!)))))
(define (really-steal-channel-port! port owner)
(let ((lock (port-lock port))
(buffer (port-buffer port))
(index (port-index port))
(limit (port-limit port))
(eof? (port-pending-eof? port))
(status (steal-channel! (port->channel port) owner)))
(set-port-buffer! port (make-code-vector (code-vector-length buffer) 0))
(set-port-index! port 0)
(set-port-limit! port (if (input-port? port) 0 (code-vector-length buffer)))
(set-port-pending-eof?! port #f)
(set-port-locked?! port #f)
(set-port-lock! port (make-lock))
(interrupt-thread owner
(lambda results
(obtain-port-lock port)
(cond ((output-port? port)
(really-force-output port))
((< (port-index port)
(port-limit port))
(warn "dropping input from port" port)))
(set-port-buffer! port buffer)
(set-port-index! port index)
(set-port-limit! port limit)
(set-port-pending-eof?! port eof?)
(set-port-lock! port lock)
(or status (apply values results))))
; if we took OWNER off a channel-wait queue we need to make it ready to run
(if status (make-ready owner))))