Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Simple augmentation of reader allows MS Graphics...
@ 1999-02-14 19:37 David McClain
  0 siblings, 0 replies; only message in thread
From: David McClain @ 1999-02-14 19:37 UTC (permalink / raw)
  To: Liste CAML

It is well known that Win32 console mode I/O blocks the event loop for
graphics threads. A simple external augmentation of read() allows new OCAML
toplevels to perform Window Graphics, without recompiling or altering the
runtime system.

Microsoft has graciously named their I/O primitive "_read( )" so that we can
create our own "read( )" routine to intercept uses of it at link time,
substituting our own version that in turn calls the C runtime primitive
"_read( )" when it is more appropriate -- such as from another thread. This
allows up to pump message queues in the main thread, and to start up other
graphics threads without the problems normally encountered by a blocking
"read( )".

You can get some sample code at

    http://www.azstarnet.com/~dmcclain/graphics.cpp

This code includes the augmented "read( )" routine, a separate console
reader thread, and a separate graphics thread that puts up a simple window
with some imagery. This code can be compiled and used ahead of the C runtime
libraries in the link command of "ocamlmktop" to create new toplevels that
enable Win32 graphics.



David McClain
Sr. Scientist
Raytheon Missile Systems Co.
Tucson, AZ
http://www.azstarnet.com/~dmcclain/homepage.htm




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-02-14 22:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-14 19:37 Simple augmentation of reader allows MS Graphics David McClain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox