caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: wester@ilt.fhg.de
Cc: caml-list@inria.fr
Subject: Re: LablTk problem
Date: Tue, 06 Feb 2001 10:22:48 +0900	[thread overview]
Message-ID: <20010206102248L.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <200102050820.JAA19345@ilt.fhg.de>

From: wester@ilt.fhg.de

> Sorry it was my fault, I found the problem. I simplified things a 
> little bit in the above example. The program as it is works fine. 
> But when I was testing the program I made the following:
> 
> Thread.start Tk.mainLoop();;
> 
> And now the menus don't work any more. What I want to do is start 
> a Tk application in it's own thread and  be able to draw to the canvas 
> interactively  at the sam time. If I press one the simple buttons the 
> application stops, only the menus don't work.

We are sorry, but ocamltk and labltk are not reentrant, so you cannot
use threads with them. Having a thread running the Tk mainloop and all
Tk calls and callbacks, while all other threads do some other work
seems to be safe (I actually use it in the Win32 version of
ocamlbrowser), but as soon as you call Tk functions in other threads
you're dead.

On Unix, Tcl/Tk provides two kinds of callbacks that may help you do
thread-like work: timeouts (module Timer) and fileinputs (module
Fileevent). They allow you to program in a non-blocking
way. Unfortunately, fileinputs do not seem to work on windows.

If you really want to use threads, you should look at lablgtk, which
is reentrant, and allows any kind of funny thing you might want to do
with threads.

Jacques Garrigue
---------------------------------------------------------------------------
Jacques Garrigue      Kyoto University     garrigue at kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>



      reply	other threads:[~2001-02-06 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-02 15:37 wester
2001-02-05  8:20 ` wester
2001-02-06  1:22   ` 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=20010206102248L.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=wester@ilt.fhg.de \
    /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).