From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: bskim@ropas.kaist.ac.kr
Cc: caml-list@inria.fr
Subject: Re: [Q] inter_process communication in CamlTk,OCaml
Date: Fri, 21 Jul 2000 11:10:04 +0900 [thread overview]
Message-ID: <20000721111004W.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: Your message of "Fri, 14 Jul 2000 01:04:57 +0900 (KST)" <Pine.GSO.4.10.10007140103180.8245-100000@ropas.kaist.ac.kr>
From: Bomshik Kim <bskim@ropas.kaist.ac.kr>
> Now I'm making some application with CamlTk and OCaml.
> Problem is how to communicate between GUI part and Working part.
>
> In GUI part, there are start_work button, and stop_work button.
> The work is started in a new_process (by fork) by clicking
> start_work button. But the work may take a long time
> (let's assume 10 min) and raise an exception.
> and I want to make the result of work shown on GUI Text.
> So GUI part should receive the result from Work part.
You might consider using threads. The idea is that you have a main
thread running the Tk main loop, and worker threads started by it.
They may communicate through mutex or events.
CamlTk is not thread safe, so you must be careful about not using any
Tk command in your worker threads, since they may cause race
conditions. Also, this will not work with bytecode threads (the
default) since you won't be able to switch threads once inside the
main loop. You have to compile Caml with posix threads instead.
I'm no expert in thread programming, so I'm not sure whether what I'm
doing is really safe, but this is actually the way the ocamlbrowser
subshell works under windows, using a worker thread to read from a
pipe (file labltk/browser/shell.ml).
Jacques
---------------------------------------------------------------------------
Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp
<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>
prev parent reply other threads:[~2000-07-21 7:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-13 16:04 Bomshik Kim
2000-07-21 2:10 ` Jacques Garrigue [this message]
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=20000721111004W.garrigue@kurims.kyoto-u.ac.jp \
--to=garrigue@kurims.kyoto-u.ac.jp \
--cc=bskim@ropas.kaist.ac.kr \
--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