English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
LablGTK app maxes out CPU
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-07-07 (13:40)
From: Jerome Vouillon <Jerome.Vouillon@p...>
Subject: Re: [Caml-list] LablGTK app maxes out CPU
On Thu, Jul 06, 2006 at 05:51:05PM -0600, Matt Gushee wrote:
> Okay, I've done the strace. I found something that appears to be 
> significant, but I don't really understand it. After the GUI is 
> displayed, there are a number of GTK library calls, and then some 
> searches for various resources--locale files, fonts, icons--and then this:
> poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN, revents=POLLHUP}], 2, 
> -1) = 1
> The last two lines are then repeated around 18000 times (identically 
> each time, as far as I can see), until the 'quit' command is received. 
> This takes place over a span of perhaps 30 seconds of real time. So 
> pretty clearly this is the CPU-eating behavior, but I still can't see 
> what is triggering it. By the way, FD #7 is my FIFO.

The POLLHUP events means that the other side of the FIFO has been
closed.  Thus, you should stop listening on the FIFO.  To be portable,
you should also stop listening when you receive a POLLIN event but
there is nothing to be read.  (Mac OS, for instance, returns POLLIN
when Linux would return POLLHUP.)

-- Jerome