Re: Glib g_io_add_watch + AX25


Andre Lohan wrote:
g_io_add_watch(rx_io, G_IO_IN, rx_io_event, NULL);

I end up with 100% CPU load when i add the channel and the callback rx_io_event never gets called.

i get loads of the following lines in short time with strace:

ioctl(4, FIONREAD, [0])                 = 0
poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN, revents=POLLHUP}], 2, -1) = 1

I've tried the same with an normal AF_INET socket and it dont "poll" so often and no 100% CPU load.

The reason why you're getting 100% CPU usage is because the poll() call is getting HUP events, but your watch doesn't handle that event. You need to add G_IO_HUP as well for your rx_io_event. (Why you're getting HUP, I have no idea; I don't know anything about AX25 sockets.)

This is a question that would probably be better on gtk-app-devel-list, gtk-devel-list is for the development of glib and gtk itself.


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