Re: Loading a file on startup
- From: Michael Rothwell <rothwell holly-springs nc us>
- To: Owen Taylor <otaylor redhat com>
- Cc: sgop users sourceforge net, gtk-app-devel-list gnome org
- Subject: Re: Loading a file on startup
- Date: Thu, 31 May 2001 17:42:27 -0400
Load the file in a second thread, or, try using mmap().
-M
On Wed, May 30, 2001 at 10:13:13AM -0400, Owen Taylor wrote:
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
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]