Browse thread
LablGTK app maxes out CPU
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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 : matt.gushee.net/software/bantam/ :
: RASCL's A Simple Configuration Language : matt.gushee.net/rascl/ :