Re: g_file_read block
- From: Shaun McCance <shaunm gnome org>
- To: Jim George <jimgeorge gmail com>
- Cc: gtk-list gnome org
- Subject: Re: g_file_read block
- Date: Fri, 20 May 2011 16:36:56 -0400
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]