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.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id A90F6BC69 for ; Mon, 30 Jul 2007 13:57:32 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6UBvWxi012470 for ; Mon, 30 Jul 2007 13:57:32 +0200 Received: by ug-out-1314.google.com with SMTP id o2so1038401uge for ; Mon, 30 Jul 2007 04:57:29 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:received:date:to:cc:subject:message-id:mail-followup-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent:from; b=NrOwC4K6y6kmEOOiaCP9K/p+MQnQKHhITiNtvQNoHDtFUeYp4aMuH+hD1pi+hRkTaMvQ1whAxALYYiXp+nZVWl/x5MAQv0a/+bbP+YdQ2cS0X9xhpFUPathVUIbMQ20H6K3+scqo4NLi8rupP3g+OKFD5P7R2QUMctN8gqJ7pmw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:date:to:cc:subject:message-id:mail-followup-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent:from; b=o4cPIh1rY9u3Tc4uH/tvZbkAD0AZURJXCt45SJ7HKBKc99fbTo5O7XjT0rWUIAEBFrNDE07nCkKh8L8HHT/IdOFVUK/4t5C91jaujYw0tbUTKxf+eEoiMSIzXxwqcJ2gBPF0z5Osj6PLDsWNQg7h57qGHHLcHwnshWrD7tteefU= Received: by 10.86.81.8 with SMTP id e8mr3862172fgb.1185796649846; Mon, 30 Jul 2007 04:57:29 -0700 (PDT) Received: from localhost ( [86.211.2.178]) by mx.google.com with ESMTPS id 31sm356268fkt.2007.07.30.04.57.27 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jul 2007 04:57:29 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Mon, 30 Jul 2007 13:57:25 +0200 Date: Mon, 30 Jul 2007 13:57:25 +0200 To: Kaspar Rohrer Cc: caml-list@inria.fr Subject: Re: [Caml-list] Native multithreaded LablGTK2? Message-ID: <20070730115725.GB28423@jiyu.gnu> Mail-Followup-To: Julien Moutinho , Kaspar Rohrer , caml-list@inria.fr References: <950BC328-B571-4736-A779-8E3EE9CF6F3E@student.ethz.ch> <20070730054047.GA11678@jiyu.gnu> <93DE46B0-285F-4066-A1CA-0A3969C728B3@student.ethz.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93DE46B0-285F-4066-A1CA-0A3969C728B3@student.ethz.ch> User-Agent: Mutt/1.5.16 (2007-06-11) From: Julien Moutinho X-j-chkmail-Score: MSGID : 46ADD22C.000 on concorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at concorde with ID 46ADD22C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lablgtk:01 0200,:01 buffer:01 pervasives:01 stdout:01 stdout:01 gtk:01 giochannel:01 gmain:01 buffer:01 ocaml:01 threads:01 wrote:01 caml-list:01 writes:01 On Mon, Jul 30, 2007 at 10:01:47AM +0200, Kaspar Rohrer wrote: >>> PS: Currently the application is single threaded, but due to output >>> redirection using pipes, I get the occassional freeze. (Pipe gets flooded!) >> Weird. > No, not at all. The redirection happens in the same thread, so if the pipe > buffer is full, all write operations will block. And because the > application is single threaded, the reader never gets a chance to empty the > pipe. Thus, freeze. Oki douki, it's just that I did not undertand why you use std(in|out) to communicate between threads... But you use them because you want a buffering machinery and you have only looked at Pervasives, right? > I'm piping stdout, because that's the only way I was able to redirect > stdout to a gtk text widget (using a GIOchannel: GMain.Io.*). If anybody > has a better idea, I'd be glad to hear it. I was originally thinking of an > out_channel that writes to a buffer instead of a file, but the Ocaml > standard library seems to be missing this functionality. Or is it? You have [Stream.t], [Buffer.t] and [GText.buffer] at your service. HTH.