After use g_io_add_watch , the cpu usage to 100%

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

 



Hi, all

 

I upload the glib-2.0 library  from 2.38.2 to 2.44.1, then the cpu usage to 100%.

After testing , I find the problem is caused by g_io_add_watch function. Following is the part code about the glib.

 

               struct sockaddr_can addr;

                struct ifreq ifr;

                int loopback = 0;

                gint fd;

                GIOChannel *io;

                guint ev_id;

 

                if (getenv("CANLOOPBACK"))

                                loopback = 1;

 

                memset(&addr, 0, sizeof(addr));

                memset(&ifr, 0, sizeof(ifr));

                fd = socket(PF_CAN, SOCK_RAW, CAN_RAW)                   

 

                addr.can_family = AF_CAN;

 

                strcpy(ifr.ifr_name,”can0”);

ioctl(fd, SIOCGIFINDEX, &ifr

                addr.can_ifindex = ifr.ifr_ifindex;

 

                setsockopt(dcan->fd, SOL_CAN_RAW, CAN_RAW_LOOPBACK, &loopback, sizeof(loopback));

 

                 bind(dcan->fd, (struct sockaddr *) &addr, sizeof(addr))

                 io = g_io_channel_unix_new(fd);

                g_assert(io);

                g_io_channel_set_encoding(io, NULL, NULL);

                g_io_channel_set_buffered(io, FALSE);

                ev_id = g_io_add_watch(io, G_IO_IN, NULL, NULL); / ev_id = g_io_add_watch(io, G_IO_IN, my_function, NULL);

 

If any people know how to solve the problem, or any information may lead to this problem, please tell me .   Thanks very much

 

Neil

 

 

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux