From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA02769 for caml-red; Tue, 13 Jun 2000 23:14:40 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA00299 for ; Tue, 13 Jun 2000 22:46:30 +0200 (MET DST) Received: from cepheus.azstarnet.com (cepheus.azstarnet.com [169.197.56.195]) by concorde.inria.fr (8.10.0/8.10.0) with ESMTP id e5DKkTP14173 for ; Tue, 13 Jun 2000 22:46:29 +0200 (MET DST) Received: from vega (dialup17ip118.tus.azstarnet.com [169.197.38.118]) by cepheus.azstarnet.com (8.9.3/8.9.3) with SMTP id NAA24440 for ; Tue, 13 Jun 2000 13:46:21 -0700 (MST) X-Sent-via: StarNet http://www.azstarnet.com/ Message-ID: <000701bfd578$8d97f080$250148bf@vega> From: "David McClain" To: Subject: Threads Package for Win/NT Date: Tue, 13 Jun 2000 13:47:10 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Sender: weis 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