From: Matt Gushee <matt@gushee.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] LablGTK app maxes out CPU
Date: Tue, 04 Jul 2006 14:00:46 -0600 [thread overview]
Message-ID: <44AAC8EE.1060805@gushee.net> (raw)
In-Reply-To: <20060704191216.GA15888@localhost>
Eric Cooper wrote:
> On Tue, Jul 04, 2006 at 12:30:11PM -0600, Matt Gushee wrote:
>> [...]
>> When the app is started but before the
>> GUI is displayed for the first time, CPU usage is negligible, but as
>> soon as the GUI is displayed, the app starts using all available CPU
>> time, and it continues to do so as long as it runs, whether the GUI is
>> displayed or not. So I wonder if there's something more I need to do to
>> keep the app well-behaved (BTW, it should never require much CPU time.
>> It's a lightweight file manager, and is graphical only in the sense that
>> it is a GUI app--it uses no icons or other images).
>
> Try making the fd nonblocking before you create the glib channel:
> Unix.set_nonblock msg_fd;
That's how it was originally. But if you look again at my code, you can
see that the version with Unix.O_NONBLOCK is commented out. That's
because on one of my machines (the one with a newer version of GTK and
LablGTK, I believe), I got exceptions every time the program tried to
read the input. I don't fully understand why, but making the channel
non-non-blocking eliminated the errors. It doesn't make sense to
me--based on my limited knowledge of how POSIX I/O works, the channel
really *should* be non-blocking. But I have no idea what kind of magic
Glib is doing behind the scenes.
--
Matt Gushee
: Bantam - lightweight file manager : matt.gushee.net/software/bantam/ :
: RASCL's A Simple Configuration Language : matt.gushee.net/rascl/ :
next prev parent reply other threads:[~2006-07-04 20:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-04 18:30 Matt Gushee
2006-07-04 18:59 ` [Caml-list] " Matt Gushee
2006-07-04 19:12 ` Eric Cooper
2006-07-04 20:00 ` Matt Gushee [this message]
2006-07-04 20:21 ` Eric Cooper
2006-07-05 23:24 ` Matt Gushee
[not found] ` <Pine.LNX.4.64.0607060354120.6166@home.oyster.ru>
2006-07-06 0:27 ` Matt Gushee
2006-07-06 2:46 ` Matt Gushee
2006-07-06 16:51 ` Jerome Vouillon
2006-07-06 19:16 ` Matt Gushee
2006-07-06 23:51 ` Matt Gushee
2006-07-07 1:26 ` SOLVED -- " Matt Gushee
2006-07-07 13:40 ` Jerome Vouillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44AAC8EE.1060805@gushee.net \
--to=matt@gushee.net \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox