[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Xavier Leroy <Xavier.Leroy@i...> |
| Subject: | Re: Break under Windows NT |
> 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