Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Don Syme <dsyme@microsoft.com>, caml-list@inria.fr
Subject: Re: Break under Windows NT
Date: Tue, 16 Mar 1999 14:50:55 +0100	[thread overview]
Message-ID: <19990316145055.47860@pauillac.inria.fr> (raw)
In-Reply-To: <39ADCF833E74D111A2D700805F1951EF0F00BA69@RED-MSG-06>; from Don Syme on Mon, Mar 15, 1999 at 06:26:51AM -0800

> 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




  reply	other threads:[~1999-03-16 15:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-15 14:26 Don Syme
1999-03-16 13:50 ` Xavier Leroy [this message]
1999-03-16 14:16 Don Syme

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990316145055.47860@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=dsyme@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox