GIOChannel Watch
- From: Burra <burra colorado edu>
- To: gtk-app-devel-list gnome org
- Subject: GIOChannel Watch
- Date: Thu, 17 Jan 2002 00:49:46 -0700 (MST)
How do I keep the g_io_watch from being called when there is no new data,
I know it's not suppose to get called when there is no data, but my app
runs at 99% cpu as the io_watch func gets called.
I am just tailing a log file... code is below... any help is much
appriciated.
file = g_io_channel_new_file (argv[1], "r", &error);
g_io_add_watch (file, G_IO_IN, get_data, NULL);
gboolean get_data (GIOChannel *source, GIOCondition condition,
gpointer data)
{
gchar *buffer;
gsize length;
GError *error = NULL;
while(g_io_channel_read_line (source, &buffer, &length, NULL, &error) ==
G_IO_STATUS_NORMAL)
{
g_print(buffer);
}
g_free(buffer);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]