-1)))
(%trace ";run-gtk until "time"\n")
(run-gtk (select-registry-handle io-registry) time)
- (%trace ";run-gtk done at "(real-time-clock)"\n"))
- (maybe-signal-io-thread-events)))
+ (%trace ";run-gtk done at "(real-time-clock)"\n"))))
(yield-current-thread)
(gtk-thread-loop))))))
(detach-thread gtk-thread))
(encode-select-registry-mode mode))))
(cond ((>= result 0) (decode-select-registry-mode result))
((= result -1) 'INTERRUPT)
- ((= result -2)
- (subprocess-global-status-tick)
- 'PROCESS-STATUS-CHANGE)
+ ((= result -2) 'PROCESS-STATUS-CHANGE)
(else
(error "Illegal result from TEST-SELECT-DESCRIPTOR:" result)))))
(deallocate-select-registry-result-vectors vfd vmode)
(cond ((= 0 result) #f)
((= -1 result) 'INTERRUPT)
- ((= -2 result)
- (subprocess-global-status-tick)
- 'PROCESS-STATUS-CHANGE)
+ ((= -2 result) 'PROCESS-STATUS-CHANGE)
(else
(error "Illegal result from TEST-SELECT-REGISTRY:"
result))))))))
(if (eqv? status 0)
(begin
(block-on-process-status-change)
- (subprocess-global-status-tick)
(handle-subprocess-status-change)))))))
(define hook/subprocess-wait normal/subprocess-wait)
((3) 'JOB-CONTROL)
(else (error "Illegal process job-control status:" n)))))
\f
-(define (handle-subprocess-status-change)
- (if hook/subprocess-status-change (hook/subprocess-status-change))
- (if (eq? 'NT microcode-id/operating-system)
- (for-each (lambda (process)
- (if (memq (subprocess-status process) '(EXITED SIGNALLED))
- (close-subprocess-i/o process)))
- (subprocess-list))))
+(define last-global-tick '())
-(define hook/subprocess-status-change #f)
+(define (handle-subprocess-status-change)
+ (let ((latest-tick (subprocess-global-status-tick)))
+ (if (not (eq? latest-tick last-global-tick))
+ (begin
+ (for-each (lambda (process)
+ (if (memq (subprocess-status process) '(EXITED SIGNALLED))
+ (close-subprocess-i/o process)))
+ (subprocess-list))
+ (signal-subprocess-status-change)
+ (set! last-global-tick latest-tick)))))
(define-integrable subprocess-job-control-available?
(ucode-primitive os-job-control? 0))
handle-subprocess-status-change)
(export (runtime socket)
handle-subprocess-status-change)
+ (export (runtime thread)
+ handle-subprocess-status-change)
(import (runtime thread)
- block-on-process-status-change)
+ block-on-process-status-change
+ signal-subprocess-status-change)
(initialization (initialize-package!)))
(define-package (runtime synchronous-subprocess)
(yield-thread thread))))))
(define (yield-thread thread #!optional fp-env)
+ (maybe-signal-io-thread-events)
(let ((next (thread/next thread)))
(%trace ";yield-thread: "thread" yields to "next"\n")
(if (not next)
(vector-ref result 1)
(vector-ref result 2)))
((eq? 'PROCESS-STATUS-CHANGE result)
- (signal-io-thread-events 1
- '#(PROCESS-STATUS-CHANGE)
- '#(READ)))))
+ (handle-subprocess-status-change))))
+
+(define (signal-subprocess-status-change)
+ (signal-io-thread-events 1 '#(PROCESS-STATUS-CHANGE) '#(READ)))
(define (maybe-signal-io-thread-events)
(%trace ";maybe-signal-io-thread-events")
- (if io-registrations
- (let ((result (test-select-registry io-registry #f)))
- (%trace " => "(and result (vector-ref result 0))"\n")
- (signal-select-result result))
- (%trace " => 0\n")))
+ (let ((result (test-select-registry io-registry #f)))
+ (%trace " => "(and result (vector-ref result 0))"\n")
+ (signal-select-result result)))
(define (block-on-io-descriptor descriptor mode)
(without-interrupts
"runtime/test-floenv"
"runtime/test-hash-table"
"runtime/test-integer-bits"
-; "runtime/test-process"
+ "runtime/test-process"
"runtime/test-regsexp"
("runtime/test-wttree" (runtime wt-tree))
"ffi/test-ffi.scm"