Fixed subprocess-wait, without blocking the toolkit.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Sun, 16 Jan 2011 08:00:35 +0000 (01:00 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Mon, 17 Jan 2011 07:52:11 +0000 (00:52 -0700)
commit2b7327cc0b98202522359dea27385125b8aafb7c
tree52c6a80d111d44f2733fdc7e8525cf5d2390895e
parent1236dacad01d3d0a1553015515b818d487519436
Fixed subprocess-wait, without blocking the toolkit.

* doc/gtk/gtk.texinfo, src/gtk/thread.scm, src/gtk/gtk.pkg: Rename
kill-gtk-thread to stop-gtk-thread, and export it to () for easy
emergency(!) use.

* src/gtk/: fix-demo.scm, gobject.scm, swat.scm: Use detach-thread.

* src/gtk/fix-layout.scm: Call gtk_widget_set_size_request; frobbing
GtkWidget requisition no longer (as of 2.22) works.  Leave the widget
geometry undefined until the allocation callback can set it.

Added fix-ink-move!  methods for image and box inks.  These are very
simple methods, much like the method for text inks.  Factored them
into a new generic-fix-ink-move! integrable.

* src/gtk/gtk.pkg: Import hook/subprocess-wait and nonblocking/
subprocess-wait, to enable non-blocking "synchronous" subprocesses.

* src/gtk/main.scm: Move startup out of initialize-package!, into
gtk-start, which is now used by make.scm.  Thus startup is delayed
from load/compile(!)-time to load-option-time.  Use exit- rather than
kill-gtk-thread.  Fix type of argument to gtk_time_slice_window.

* src/gtk/make.scm: Use new gtk-start procedure.

* src/gtk/thread.scm: Added exit-gtk-thread and restart-gtk-thread.

* src/microcode/uxio.c (OS_test_select_registry): Fixed to return
SELECT_PROCESS_STATUS_CHANGE (or SELECT_INTERRUPT) instead of 0 when there
is no io (or the registry is empty) BUT pending status changes or
interrupts.

* src/runtime/process.scm (subprocess-wait): Replaced the call to the
process-wait primitive with application of hook/subprocess-wait.
Initialized this new binding to normal/subprocess-wait, which simply
calls the primitive.  Implemented an alternative procedure,
nonblocking/subprocess-wait, which uses the new block-on-process-
status-change procedure.  Added hook/subprocess-status-change.

* src/runtime/runtime.pkg: Import block-on-process-status-change from
(runtime thread) to (runtime process).

* src/runtime/thread-queue.scm: Added thread-queue/dequeue-no-hang and
thread-queue/dequeue-until, implementing the former in terms of the
latter.  Like /peek-until, /dequeue-until does the job, which was
factored out into when-non-empty-before.

* src/runtime/thread.scm: Added block-on-process-status-change.  Like
block-on-io-descriptor, it adds current-thread to those waiting on
descriptor 'process-status-change.
15 files changed:
doc/gtk/gtk.texinfo
src/gtk/fix-demo.scm
src/gtk/fix-layout.scm
src/gtk/gobject.scm
src/gtk/gtk-new.pkg
src/gtk/gtk.pkg
src/gtk/main.scm
src/gtk/make.scm
src/gtk/swat.scm
src/gtk/thread.scm
src/microcode/uxio.c
src/runtime/process.scm
src/runtime/runtime.pkg
src/runtime/thread-queue.scm
src/runtime/thread.scm