Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jerome Vouillon <Jerome.Vouillon@inria.fr>
To: Trevor Jim <tjim@saul.cis.upenn.edu>, dsyme@microsoft.com
Cc: caml-list@inria.fr
Subject: Re: threads & OCamlTK
Date: Tue, 23 Mar 1999 16:07:29 +0100	[thread overview]
Message-ID: <19990323160729.18130@pauillac.inria.fr> (raw)
In-Reply-To: <199903221839.NAA20107@saul.cis.upenn.edu>; from Trevor Jim on Mon, Mar 22, 1999 at 01:39:10PM -0500

On Mon, Mar 22, 1999 at 01:39:10PM -0500, Trevor Jim wrote:
> I've been using camltk with threads for a while.  I find it is faster
> to run Tk as its own process -- the thread scheduler doesn't seem to
> do a good job with Tk involved.

There is a mutex that prevents two Caml threads from running
simultaneously.  I think what happens is that the Tk main loop
blocks while still holding the mutex.
You should try to release the mutex before entering this loop, and
acquire it again before each call to a Caml function. For instance,
in file cltkEvents.c:
    +extern void enter_blocking_section (void);
    +extern void leave_blocking_section (void);

     value camltk_tk_mainloop() /* ML */
     {
       CheckInit();

       if (!signal_events) {
         /* Initialise signal handling */
         signal_events = 1;
         Tk_CreateTimerHandler(100, invoke_pending_caml_signals, NULL);
       };
    +  enter_blocking_section();
       Tk_MainLoop();
    +  leave_blocking_section();
       return Val_unit;
     }
and in file cltkCaml.c:
   +leave_blocking_section();
    callback2(*handler_code,Val_int(id),copy_string_list(argc - 2,&argv[2]));
   +enter_blocking_section();

-- Jérôme




  parent reply	other threads:[~1999-03-24 14:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-15 15:05 Don Syme
1999-03-16 17:18 ` Francois Rouaix
1999-03-16 17:42   ` Jun P. Furuse
1999-03-22 18:39 ` Trevor Jim
1999-03-22 20:04   ` William Chesters
1999-03-23 16:08     ` Xavier Leroy
1999-03-23 15:07   ` Jerome Vouillon [this message]
1999-03-24 17:27     ` William Chesters
1999-03-16 17:32 William Chesters
1999-03-17 15:02 Don Syme
1999-03-17 15:57 ` William Chesters

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=19990323160729.18130@pauillac.inria.fr \
    --to=jerome.vouillon@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=dsyme@microsoft.com \
    --cc=tjim@saul.cis.upenn.edu \
    /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