From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA27995 for caml-redistribution@pauillac.inria.fr; Wed, 16 Feb 2000 10:46:00 +0100 (MET) Resent-Message-Id: <200002160946.KAA27995@pauillac.inria.fr> 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 RAA18264 for ; Tue, 15 Feb 2000 17:06:59 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id RAA05068; Tue, 15 Feb 2000 17:06:52 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA32544; Tue, 15 Feb 2000 17:06:53 +0100 (MET) Message-ID: <20000215170653.54672@pauillac.inria.fr> Date: Tue, 15 Feb 2000 17:06:53 +0100 From: Xavier Leroy To: Christophe Raffalli , caml-list@inria.fr Subject: Re: Thread feature missing References: <20000211111749.34427@pauillac.inria.fr> <20000213073403Q.garrigue@kurims.kyoto-u.ac.jp> <38A7B721.172F585C@univ-savoie.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <38A7B721.172F585C@univ-savoie.fr>; from Christophe Raffalli on Mon, Feb 14, 2000 at 09:04:49AM +0100 Resent-From: weis@pauillac.inria.fr Resent-Date: Wed, 16 Feb 2000 10:46:00 +0100 Resent-To: caml-redistribution@pauillac.inria.fr > Have I miss something ? I found that two features (especialy the first) > are missing in the thread library: No, you didn't miss anything. The OCaml thread interface is somehow constrained to the intersection of what can be implemented on top of the virtual machine (for bytecode threads) and of what POSIX and Win32 threads provide (for system threads). > - No way to wait for one thread to finish among many (equivalent of > join, but taking a list of threads as argument) This isn't supported directly in POSIX threads. However, you can easily program it yourself using e.g. events: allocate a channel, have each thread send a message on it when it terminates, and wait for a message on the channel. The good thing about this method is that you can put whatever you need in the message (thread ID, return value, etc). > - No way to send a signal to a thread (it would be useful to make a > thread raise an exception from another thread). I agree this would be nice, and can easily be implemented in the case of bytecode threads. For POSIX threads, one could try using cancellation to handle this, but I'm not sure it can be done in a portable way. For Win32 threads, I don't know how to do it. - Xavier Leroy