From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 5B196BB83 for ; Tue, 4 Jul 2006 22:21:21 +0200 (CEST) Received: from chokecherry.srv.cs.cmu.edu (CHOKECHERRY.SRV.CS.CMU.EDU [128.2.185.41]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k64KLKGx017745 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 4 Jul 2006 22:21:21 +0200 Received: from stratocaster.home (c-24-3-154-200.hsd1.pa.comcast.net [24.3.154.200]) (authenticated bits=0) by chokecherry.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id k64KLIN8015212 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Tue, 4 Jul 2006 16:21:18 -0400 (EDT) Received: from ecc by stratocaster.home with local (Exim 4.62) (envelope-from ) id 1FxrOX-0004AZ-UF; Tue, 04 Jul 2006 16:21:17 -0400 Date: Tue, 4 Jul 2006 16:21:17 -0400 To: caml-list@yquem.inria.fr, caml-list@inria.fr Subject: Re: [Caml-list] LablGTK app maxes out CPU Message-ID: <20060704202117.GB15987@localhost> Mail-Followup-To: caml-list@yquem.inria.fr, caml-list@inria.fr References: <44AAB3B3.6000807@gushee.net> <20060704191216.GA15888@localhost> <44AAC8EE.1060805@gushee.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44AAC8EE.1060805@gushee.net> User-Agent: Mutt/1.5.11+cvs20060403 From: Eric Cooper X-Miltered: at nez-perce with ID 44AACDC0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lablgtk:01 unix:01 nonblock:01 unix:01 nonblock:01 gtk:01 lablgtk:01 buf:01 buf:01 2006:98 wrote:01 wrote:01 caml-list:01 exceptions:01 len:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 On Tue, Jul 04, 2006 at 02:00:46PM -0600, Matt Gushee wrote: > Eric Cooper wrote: > >Try making the fd nonblocking before you create the glib channel: > > Unix.set_nonblock msg_fd; > > That's how it was originally. But if you look again at my code, you can > see that the version with Unix.O_NONBLOCK is commented out. That's > because on one of my machines (the one with a newer version of GTK and > LablGTK, I believe), I got exceptions every time the program tried to > read the input. Right, me too. I use code like this to read from the channel inside the watcher: let try_read chan ~buf ~pos ~len = try Some (Glib.Io.read chan ~buf ~pos ~len) with Glib.GError "g_io_channel_read: G_IO_ERROR_AGAIN" -> None -- Eric Cooper e c c @ c m u . e d u