From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 11EC3BC69 for ; Tue, 13 Nov 2007 22:08:17 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAF6gOUdQDPIalmdsb2JhbACBW40hAQEBAQcEBhERB4EP X-IronPort-AV: E=Sophos;i="4.21,411,1188770400"; d="scan'208";a="19246741" Received: from smtp20.orange.fr ([80.12.242.26]) by mail4-smtp-sop.national.inria.fr with ESMTP; 13 Nov 2007 22:08:16 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2004.orange.fr (SMTP Server) with ESMTP id 5A6B81C000E0 for ; Tue, 13 Nov 2007 22:08:16 +0100 (CET) Received: from localhost.localdomain (Mix-Lyon-303-4-207.w193-248.abo.wanadoo.fr [193.248.106.207]) by mwinf2004.orange.fr (SMTP Server) with ESMTP id 04E961C000DE for ; Tue, 13 Nov 2007 22:08:14 +0100 (CET) X-ME-UUID: 20071113210815201.04E961C000DE@mwinf2004.orange.fr Date: Tue, 13 Nov 2007 21:10:10 +0100 From: Fabrice Marchant To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Why 'Graphics.wait_next_event' doesn't reply anymore ? Message-ID: <20071113211010.6209d882@localhost.localdomain> In-Reply-To: <1194948872.473979088166f@webmail.in-berlin.de> References: <20071110230145.3aebafe4@localhost.localdomain> <20071111150720.4f8d1c44@localhost.localdomain> <1194799714.473732620f33e@webmail.in-berlin.de> <20071111204019.4697d387@localhost.localdomain> <1194828182.4737a196e3582@webmail.in-berlin.de> <20071112205411.0d2d6dfc@localhost.localdomain> <1194902314.4738c32a070fd@webmail.in-berlin.de> <20071113084547.2214223f@localhost.localdomain> <1194948872.473979088166f@webmail.in-berlin.de> X-Mailer: Claws Mail 2.10.0 (GTK+ 2.10.13; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; bandel:01 in-berlin:01 ocaml:01 colours:01 scheduler:01 mutexes:01 zoom:98 dragging:98 threads:01 wrote:01 oliver:01 oliver:01 caml-list:01 functions:01 data:02 On Tue, 13 Nov 2007 11:14:32 +0100 Oliver Bandel wrote: > So, it was not OCaml nor the Graphics module that is buggy ;-) But I wonder why I didn't see any word about these necessary "precaution" in doc. (Maybe have missed something ?) > > I'm very happy my Game of Life finally works. > > Are the new sources online? The code is'nt yet very clean but I seize the opportunity to show it you offer to me : http://fabrice.marchant.free.fr/fl/funLife/ > How to play it? Press '?' or 'H' for help page ( directed to console ). > Now that it works, I may play around with it for a while.... :) It features an "infinite" board, a zoom, mouse dragging of the view, history and customizable colours. Many things can be changed "on the fly" - when automaton is running - but maybe it remains some bugs about this. ( Nothing to do with the powerful top speed "xlife". ) However, 'll try to improve and the TODO list is long... > > 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 ? > > Yes, Graphics modules internals. > Both threads might share a lot of data. > They are drawing at the same screen, > so if their work might be interrupted by the > scheduler before the data was written completely, > something might go wrong. > > If you can't be sure that the data is isolated, > use Mutexes. And in the case of the Graphics-module you > don't get back a value that holds something, > e.g. when using the initialization functions. > So seemingly they all write on the same data. > (And to have a copy of the whole screen always, > would be wasting memory, so I think it's ok this way.) I tried to use Mutex again this way for changing autoplay speed. Seems to work. Regards, Fabrice