Re: What causes GLib I/O Channels operations to use up 100% CPU in GTK+ app.?
- From: tomas tuxteam de
- To: Daniel Yek <dyek real com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: What causes GLib I/O Channels operations to use up 100% CPU in GTK+ app.?
- Date: Fri, 13 Oct 2006 04:36:27 +0000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thu, Oct 12, 2006 at 02:41:06AM -0700, Daniel Yek wrote:
Attaching file in email body...
At 02:36 AM 10/12/2006, Daniel Yek wrote:
Hi,
I am attaching the source code of a small test program here.
Could somebody enlighten me why after an I/O Channel operation
(g_io_channel_shutdown() here), the GTK+ program started to use up 100% CPU?
Is it monitoring something? Do I need to undo g_io_add_watch() somehow?
What operation is needed to not get into such situation?
I just browsed through your program (so take my rablings with a grain of
salt), but a couple of things strike me:
- who is writing to the writing end of the pipe? Note that writing
into and reading from the same pipe is not recommended (although for
a small test program and if you are writing small amounts of data
you might get away with iti ;-)
- One thing which happens easily is: when the writing side closes, the
reading side gets a read with 0 bytes (as a "signal" of EOF). In a
select() (and that is what is at GTK's core dispatching things),
this file descriptor is considered ready (but yielding zero bytes).
I don't know whether GIOChannel wraps this (I doubt it can), but this
is the typical cause for "spinning" in such programs.
Uh. I don't know if I was clear.
Regards
- -- tomÃÂs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFFLxfLBcgs9XrR2kYRAqL1AJ0aWX4FB+eiezulMK1hg/clx/fBLACcDvOO
4ZuTtrJ6ExmCrcOsqne3AZ4=
=qwza
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]