Version française
Home     About     Download     Resources     Contact us    
Browse thread
Native multithreaded LablGTK2?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Julien Moutinho <julien.moutinho@g...>
Subject: Re: [Caml-list] Native multithreaded LablGTK2?
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.