Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 (01:25)
From: Matt Gushee <matt@g...>
Subject: SOLVED -- Re: [Caml-list] LablGTK app maxes out CPU
Matt Gushee wrote:

> Well, based on the above, I tried adding a second watch function:
>   let hup_watcher _ = Util.sleep 0.25; true in
>   (* ... unrelated code omitted ... *)
>   ignore (GMain.Io.add_watch ~cond:[`HUP] ~callback:hup_watcher chan)
> Finally, this produces a change in behavior--but not quite what I need. 
> CPU usage is under control, but now the GUI fails to display completely: 
> the main window appears, with the outine of the TreeView widget it is 
> supposed to have, but the contents are never displayed.

I was on the right track with the above--I just needed to set the 
hup_watcher to a lower priority, e.g.

   let low_priority = Glib.int_of_priority `LOW in
   ignore (GMain.Io.add_watch ~prio:low_priority ~cond:[`HUP]
     ~callback:hup_watcher chan)

I'm not sure whether `LOW or `DEFAULT_IDLE is best, but both seem to 
produce good results.

Many thanks to those who helped.

Matt Gushee
: Bantam - lightweight file manager : :
: RASCL's A Simple Configuration Language : :