Re: Loading a file on startup



Markus Lausser <sgop users sourceforge net> writes:

Hello.

I want to load a huge file on startup, this lasts up to a few minutes, but
my application should not freeze.
At the moment i have realized this with a gtk_idle_add(), but i would prefer
the gdk_input_add() method. But this freezes my application until the whole
file was read.

And now i wonder:
if i use gtk_input_add() on a socket to download from another machine, my app
never freezes (also if there is always data available). SO, why does my app 
when reading from a file?
 
Some types of file descriptors (like files) are considered
"fast" and for these file descriptors, the poll() and select() system
calls [ what gdk_input_add() uses internally ] will always indicate
that there is something available for reading.

For that reason, you can't meaningfully use gdk_input_add() with a 
local file. You could conceivably use another process to read in
the file and send it over a pipe to the main process. 

However, even that way, the data will most likely come in fast
enough to effectively hang your application.

Regards,
                                        Owen 




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