caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Coste <alaincoste@club-internet.fr>
To: caml-list@inria.fr
Subject: [Caml-list] interrupt OCaml when using the Graphics library
Date: Wed, 27 Feb 2013 19:35:52 +0100	[thread overview]
Message-ID: <58FDBA43E51F42D083872E99902EA8F3@Ganymede> (raw)

Hello
I work with OCaml-4 and windows XP.
I am using the Graphics library, and I don't know how to wake-up OCaml when 
it is suspended waiting for an event in the graphic window.
Some cases when this happens:
   - I interrupt OCaml with ^C; nothing happens until I move the mouse or 
clic in the graphic window.
   - The graphic window is killed (click on  X in the window title); here 
things are worse as I can no longer send an event to the window; OCaml is 
definitly blocked.
   - The graphic window is resized (with the mouse); my program cannot 
update the contents of the window until I release the mouse button and move 
the mouse (or click) inside the window.

When OCaml runs in text mode (ie not in the graphic window) it can also get 
suspended waiting for input on stdin, but the process which runs OCaml 
(XEmacs with comint in my case) can simply send a character to its stdin 
after sending sigint, OCaml is waked-up and processes the interrupt.

I have tried to change the behavior of OCaml with Sys.signal, but this 
doesn't work as OCaml doesn't recognize sigint while it is suspended.

The only workaround I found is to ask XEmacs to run an ahk script which 
posts a message or sends a click to the graphic window;
but this works only if the window is still alive and is rather convoluted...

I suppose there is a better method to do this, but I am stuck down.

Alain Coste 

             reply	other threads:[~2013-02-27 18:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27 18:35 Alain Coste [this message]
2013-02-28  0:39 ` ygrek

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=58FDBA43E51F42D083872E99902EA8F3@Ganymede \
    --to=alaincoste@club-internet.fr \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).