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: Fabrice Marchant <fabrice.marchant@o...>
Subject: Re: [Caml-list] Why 'Graphics.wait_next_event' doesn't reply anymore ?
> 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!

  Great ! Oliver, it was this. All perfectly rocks at full speed now.
I'm very happy my Game of Life finally works.
However, I've not understood why this Mutex was needed : what could be
the data shared with 'wait_next_event' ?
  Some internal of Graphics module ?