caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Threads Package for Win/NT
@ 2000-06-13 20:47 David McClain
  0 siblings, 0 replies; only message in thread
From: David McClain @ 2000-06-13 20:47 UTC (permalink / raw)
  To: caml-list

Hi all!

In case anyone is interested, I have slightly modified the threads package
on Win/NT to make event channels behave somewhat more closely to the
Channels described by John Reppy in his new book on Concurrent ML. We have
everything that CML has, except that we can't use speculative threading to
any great extent. I don't know how to make the GC collect suspended
threads...  But other than that the behavior is now very close to Reppy's
description.

Changes were mostly very minor to Condition.ml, Mutex.ml, and Thread.ml. The
C source Win32.c had to be slightly altered to accommodate cleanup of
permanently suspended threads, and to add some safety checking on waiting
for condition vars and mutexes that get discarded. The major changes
occurred in Event.ml where Reppy-style channel handling was extended for
sync() and poll() operations. New routines were also added:

Thread.init : unit -> unit
Mutex.discard : Mutex.t -> unit
Condition.discard : Condition.t -> unit
Event.discard_channel : 'a Event.channel -> unit

Event.with_nack : (unit Event.event -> 'a Event.event) -> 'a Event.event
        (* [with_nack fn] returns the event that, when synchronized,
    computes [fn nackEvt] and behaves as the resulting event.
    [fn nackEvt] should compute an event as in [guard fn] that
    can serve as a synchronization point.
    [nackEvt] will be a unit event that represents the event
    signaled when the event computed by [fn nackEvt] is *NOT*
    chosen. *)

You can get the slightly modified sources at:
http://www.azstarnet.com/~dmcclain/threads.zip (18K compressed)

Also, since startup of the threads package interferes with COM/OLE
registration, I have invented a Thread.init : unit -> unit. Hence in order
to launch the use of threads one must explicitly call Thread.init().
Automatic startup, although desirable, conflicts with the automatic
registration process for Windows COM DLL's. If this is no concern to you, it
is easy to change the startup behavior in Threads.ml.

Cheers,

David McClain






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

only message in thread, other threads:[~2000-06-13 21:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-13 20:47 Threads Package for Win/NT David McClain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).