Browse thread
Why 'Graphics.wait_next_event' doesn't reply anymore ?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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 <fabrice.marchant@orange.fr>:
[...]
> In fact the true application where the problem originally raised is :
> http://fabrice.marchant.free.fr/funLife/
[...]
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!
Ciao,
Oliver
P.S.: The Mutex must be in the environment of both threads,
so must be defined at the toplevel of the autoPlay.ml,
which means unit-global, as "running" also is.