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 QAA14357 for caml-redistribution; Tue, 16 Mar 1999 16:08:21 +0100 (MET) 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 OAA21239 for ; Tue, 16 Mar 1999 14:51:01 +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 OAA01335; Tue, 16 Mar 1999 14:50:54 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA14443; Tue, 16 Mar 1999 14:50:55 +0100 (MET) Message-ID: <19990316145055.47860@pauillac.inria.fr> Date: Tue, 16 Mar 1999 14:50:55 +0100 From: Xavier Leroy To: Don Syme , caml-list@inria.fr Subject: Re: Break under Windows NT References: <39ADCF833E74D111A2D700805F1951EF0F00BA69@RED-MSG-06> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <39ADCF833E74D111A2D700805F1951EF0F00BA69@RED-MSG-06>; from Don Syme on Mon, Mar 15, 1999 at 06:26:51AM -0800 Sender: weis > Is it true that under the Windows NT version of OCaml there's no easy way of > sending the equivalent of a SIGINT to a OCaml process and have OCaml raise > an exception? As far as I know, Win32 has no equivalent to Unix signals (i.e. the ability for a process to interrupt asynchronously another process). For "console" applications, the C library implements some notion of signals (for ANSI C compatibility), but SIGINT is only generated when the user types ctrl-C or ctrl-break at the keyboard, or when the program sends SIGINT to itself; it cannot be generated from another process. A classic alternative to signals is to use multiple threads: one thread synchronously waits for some external notification, then fakes a pending signal condition in the other thread that is running the Caml code. However, Caml threads do not have (yet) the ability to raise exceptions in other threads, so one has to implement this solution in C. If you tell me in more details what you're trying to achieve, maybe I could send you some sample code. > Or have I missed something? I need to be able to > asynchronously break long running computations under NT. BTW I'm also using > OCamlTK. OCamlTk programs are not console-only applications, and thus have an event loop that runs periodically. This adds more opportunities for implementing inter-process notification, via periodic polling or by posting special events on the application's message queue; however, I haven't looked into this in details. - Xavier Leroy