Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Why 'Graphics.wait_next_event' doesn't reply anymore ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] Why 'Graphics.wait_next_event' doesn't reply anymore ?
Hi Fabrice,

Zitat von Fabrice Marchant <>:
>   In fact the true application where the problem originally raised is :

I only have looked some minutes into the code.
fast browsed ;-)

Both threads use the Graphics-module (via View-module).
Possibly the problem is, that the access
is not protected: use Mutexes, when calling the View.<function>,
so that each Thread only has access to the View-functions
(and the Graphics module's functions), when the other thread
is ready with it's work. Otherwise possibly things become confused.

So, wrap each of the View.<function> calls with
calls to Mutex.lock and Mutex.unlock.

Possibly this is your main problem!


P.S.: The Mutex must be in the environment of both threads,
      so must be defined at the toplevel of the,
      which means unit-global, as "running" also is.