[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk
Subject:    Re: g_file_read block
From:       Shaun McCance <shaunm () gnome ! org>
Date:       2011-05-20 20:36:56
Message-ID: 1305923816.2142.197.camel () recto
[Download RAW message or body]

On Wed, 2011-05-18 at 18:11 -0600, Jim George wrote:
> Hello list,
> In my application, I'm trying to connect to a remote webserver and
> grab an image file (output of a CGI program), and I'm trying to use
> GIO for this. I call g_file_new_for_uri with the URL, and then call
> g_file_read to get the input stream. It works for the most part, but
> I'm seeing that if the application ends up sending a larger number of
> consecutive requests (user requests refreshes very often), the program
> locks up. Running under gdb, I can do a ^C and backtrace, it fails on
> the call to g_file_read. Somewhere deep inside g_file_read, the
> program is waiting in a call to "poll".
> 
> Am I calling things in the wrong order? I do have a cancellable and a
> GError passed to g_file_read, if that makes a difference.

g_file_read is synchronous. Unless you've tucked this stuff into
a separate thread, you shouldn't use the synchronous API in a GUI
application. Use async functions like g_file_read_async instead.

http://developer.gnome.org/gio/2.29/GFile.html#g-file-read-async

--
Shaun


_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic