Re: [gtkmm] app calls poll() for disconnected connections



Am 24.09.2002 21:59 schrieb(en) Eric Buddington:
stracing my app, I see incessant (to the point of using all CPU time)
poll() calls that are returning POLLNVAL for file descriptors that
should no longer be watched. Specifically, my main app forks off
children and tries to communicate with them via pipes.

In this case, file descriptors 7, 9, and 11 are pipes from short-lived
children, and 13 and 15 are pipes to long-lived children. Each
initially is watched by a Connection, created as:

input_connection = Glib::signal_io().connect
    (SigC::slot(*this, &PluginProxy::on_output),
     from_child_fd(),
     Glib::IO_IN | Glib::IO_OUT | Glib::IO_PRI | Glib::IO_ERR |
Glib::IO_HUP);

All correctly note the "Broken Pipe" error when the child dies, and all
have disconnect() called on them at that point. After this point, the
'on_output' function is no longer called, but the poll() still watches
the fds and sucks cycles:

poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN, revents=POLLNVAL},
{fd=9, events=POLLIN, revents=POLLNVAL}, {fd=11, events=POLLIN,
revents=POLLNVAL}, {fd=13, events=POLLIN}, {fd=15, events=POLLIN}], 6,
-1) = 3

Shouldn't GTK stop watching the fd as soon as I call disconnect() on
the Connection?

Of course it should! And obviously it doesn't! => bug => bugzilla
I will look into this now.

Regards,

  Martin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]