[OT] Re: [MM] [PATCH v2] iface-modem,novatel-lte: disable network scan in LTE mode

2013-01-04 Thread Marius Kotsbak
On Jan 4, 2013 12:58 AM, Aleksander Morgado aleksan...@lanedo.com wrote:

 You cannot mix in the same async method a code execution path using
 mm_base_modem_at_command() with another one using GSimpleAsyncResult and
 completion in idle.  When you use mm_base_modem_at_command(), in
 finish() you're expected to use mm_base_modem_at_command_finish(), like
 you did. But when you use GSimpleAsyncResult and completion in idle you
 should use g_simple_async_result_propagate_error() in finish(). The fact
 that it may work as expected is due to how at_command_finish() is
 implemented; but you shouldn't rely on that.

 So you'll need to use GSimpleAsyncResult for both cases, i.e. provide a
 _ready() GAsyncReadyCallback in mm_base_modem_at_command() to which you
 pass 'simple' as user_data; and then complete the 'simple' from within
 the _ready() method. In this way, you can safely call
 g_simple_async_result_propagate_error() in finish().

Offtopic, but do you know where this is documented? Any books, online docs
or api docs to recommend? Is it part of gnome/glibs, or dbus?

--
Marius
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [OT] Re: [MM] [PATCH v2] iface-modem, novatel-lte: disable network scan in LTE mode

2013-01-04 Thread Aleksander Morgado

 
 You cannot mix in the same async method a code execution path using
 mm_base_modem_at_command() with another one using GSimpleAsyncResult and
 completion in idle.  When you use mm_base_modem_at_command(), in
 finish() you're expected to use mm_base_modem_at_command_finish(), like
 you did. But when you use GSimpleAsyncResult and completion in idle you
 should use g_simple_async_result_propagate_error() in finish(). The fact
 that it may work as expected is due to how at_command_finish() is
 implemented; but you shouldn't rely on that.

 So you'll need to use GSimpleAsyncResult for both cases, i.e. provide a
 _ready() GAsyncReadyCallback in mm_base_modem_at_command() to which you
 pass 'simple' as user_data; and then complete the 'simple' from within
 the _ready() method. In this way, you can safely call
 g_simple_async_result_propagate_error() in finish().
 
 Offtopic, but do you know where this is documented? Any books, online
 docs or api docs to recommend? Is it part of gnome/glibs, or dbus?
 

If you mean the overall GSimpleAsyncResult behaviour; I guess the
reference is still the GLib/GIO API documentation:
http://developer.gnome.org/gio/unstable/GSimpleAsyncResult.html

But note that for new code, GTask is the new better and cleaner
GSimpleAsyncResult replacement:
http://developer.gnome.org/gio/unstable/GTask.html

There's no manual or tutorial just talking about async GIO functions,
AFAIK, I guess you just end up getting used to it...

-- 
Aleksander
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list