Re: Discouraging use of sync APIs
- From: Bastien Nocera <hadess hadess net>
- To: Philip Withnall <philip tecnocode co uk>
- Cc: desktop-devel-list <desktop-devel-list gnome org>
- Subject: Re: Discouraging use of sync APIs
- Date: Mon, 09 Feb 2015 14:55:31 +0100
On Mon, 2015-02-09 at 13:42 +0000, Philip Withnall wrote:
On Mon, 2015-02-09 at 14:02 +0100, Bastien Nocera wrote:
On Mon, 2015-02-09 at 12:53 +0000, Emmanuele Bassi wrote:
<snip>
I do agree with Philip's proposal of warning if the sync API is called
inside the default main context, even if there's the obvious issue of
console-only code that still uses a main loop, but does not have
interactivity issues.
I wouldn't want that. I can certainly see that as a necessary evil (say
on application startup), and would rather it threw an error if that sync
call took too long instead.
Why can the startup code not use a GMainLoop? Is there some pattern I’ve
missed? I thought in all such situations you could still do with a main
loop so you could handle Ctrl+C nicely.
What's "handling Ctrl+C" nicely? I can Ctrl+C stuck applications fine in
most cases, and I wouldn't want the handling of such a feature to be the
main driver behind my API decisions.
On startup, you should try to get the maximum amount of work done in the
minimum amount of time. In some cases, pre-populating the UI (while
"blocking" the mainloop) is a better idea than seeing jarring effects
after the fact, once the UI has been loaded.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]