Re: letting a function timeout



Emmanuel Saracco wrote:

On 20 Nov 2002 09:43:19 +0100
Juan Agüí <jagui die upm es> wrote:

El mié, 20-11-2002 a las 00:30, Thijs Assies escribió:
Hi,
I am using gnome-vfs to get a file. And i want GTK/GLIB to stop the function when it takes too long. gnome-vfs doesnt have a function
like that. Does anyone knows how to do this.

An idea:

#define SECS (5) /* 5 seconds timeout */
int timeout_id;
int timeout_period=1000*SECS;

timeout_func(gpointer data)
{
*data=TRUE;
gtk_timeout_remove(timeout_id);
}



function_get_file()
{
int timeout_flag=0;

timeout_id=gtk_timeout_add(timeout_period,timeout_func,(gpointer)&tim
eout_flag); while(!tiemout_flag)
        {
                get_file_contents;
                ...
        }       
}

I don't know gnome-vfs, but can't he define a SIGALRM for that sort of
job?

bye
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


I cant use this function because it remains in the the same line. If i use it, the function will be stopped when the downloading is complete ;)





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