<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://bugs.maemo.com/skins/common/feed.css?207"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Documentation/Maemo 5 Developer Guide/DBus/Asynchronous Glib/D-Bus - Revision history</title>
		<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.5-7</generator>
		<lastBuildDate>Fri, 10 Apr 2026 19:05:57 GMT</lastBuildDate>
		<item>
			<title>amigadave:&amp;#32;/* Asynchronous Method Calls Using GLib Wrappers */ add &lt;code&gt;</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=38329&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=38329&amp;oldid=prev</guid>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Asynchronous Method Calls Using GLib Wrappers:&amp;#32;&lt;/span&gt; add &amp;lt;code&amp;gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:31, 6 September 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 320:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 320:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Asynchronous Method Calls Using GLib Wrappers ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Asynchronous Method Calls Using GLib Wrappers ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Sometimes the interface XML is missing, so the dbus-bindings-tool cannot be run to generate the stub code. The GLib wrappers are generic enough to enable building own method calls, when necessary.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Sometimes the interface XML is missing, so the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;&lt;/ins&gt;dbus-bindings-tool&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/code&amp;gt; &lt;/ins&gt;cannot be run to generate the stub code. The GLib wrappers are generic enough to enable building own method calls, when necessary.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Starting with some known generated stub code to see which parts can possibly be reused with some modifications is usually the easiest solution. This is shown in the last step of this example, in order to make a version of the asynchronous client that works without the stub generator.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Starting with some known generated stub code to see which parts can possibly be reused with some modifications is usually the easiest solution. This is shown in the last step of this example, in order to make a version of the asynchronous client that works without the stub generator.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-10 19:05:57 --&gt;
&lt;/table&gt;</description>
			<pubDate>Mon, 06 Sep 2010 11:31:54 GMT</pubDate>			<dc:creator>amigadave</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus</comments>		</item>
		<item>
			<title>amigadave:&amp;#32;fix vcs links</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=38325&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=38325&amp;oldid=prev</guid>
			<description>&lt;p&gt;fix vcs links&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 10:29, 6 September 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The example code used below can be found in the [&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;https&lt;/del&gt;://&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;garage&lt;/del&gt;.maemo.org/svn/maemoexamples/trunk/glib-dbus-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;signals&lt;/del&gt;/ garage svn].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The example code used below can be found in the [&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;http&lt;/ins&gt;://&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;vcs&lt;/ins&gt;.maemo.org/svn/maemoexamples/trunk/glib-dbus-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;async&lt;/ins&gt;/ garage svn].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Asynchronicity in D-Bus clients ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Asynchronicity in D-Bus clients ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Slow Test Server ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Slow Test Server ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The only change on the server side is the addition of delays into each of the RPC methods (&amp;lt;code&amp;gt;setvalue1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setvalue2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getvalue1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;getvalue2&amp;lt;/code&amp;gt;). This delay is added to the start of each function as follows: glib-dbus-async/server.c&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The only change on the server side is the addition of delays into each of the RPC methods (&amp;lt;code&amp;gt;setvalue1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;setvalue2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;getvalue1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;getvalue2&amp;lt;/code&amp;gt;). This delay is added to the start of each function as follows: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[http://vcs.maemo.org/svn/maemoexamples/trunk/glib-dbus-async/server.c &lt;/ins&gt;glib-dbus-async/server.c&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 95:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 95:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Asynchronous Method Calls Using Stubs ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Asynchronous Method Calls Using Stubs ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When the &amp;lt;code&amp;gt;glib-bindings-tool&amp;lt;/code&amp;gt; is run, it already generates the necessary wrapping stubs to support launching asynchronous method calls. What is then left to do is implementing the callback functions correctly, processing the return errors and launching the method call. glib-dbus-async/client-stubs.c&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When the &amp;lt;code&amp;gt;glib-bindings-tool&amp;lt;/code&amp;gt; is run, it already generates the necessary wrapping stubs to support launching asynchronous method calls. What is then left to do is implementing the callback functions correctly, processing the return errors and launching the method call. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[http://vcs.maemo.org/svn/maemoexamples/trunk/glib-dbus-async/client-stubs.c &lt;/ins&gt;glib-dbus-async/client-stubs.c&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 103:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 103:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The client has been simplified, so that it now only operates on &amp;lt;code&amp;gt;value1&amp;lt;/code&amp;gt;. The callback that is called from the stub code is presented next: glib-dbus-async/client-stubs.c&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The client has been simplified, so that it now only operates on &amp;lt;code&amp;gt;value1&amp;lt;/code&amp;gt;. The callback that is called from the stub code is presented next: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[http://vcs.maemo.org/svn/maemoexamples/trunk/glib-dbus-async/client-stubs.c &lt;/ins&gt;glib-dbus-async/client-stubs.c&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 137:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 137:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Because the method call does not return any data, the parameters for the callback are at minimum (those three are always received). Handling errors must be performed within the callback, because errors could be delayed from the server, and not visible immediately at launch time.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Because the method call does not return any data, the parameters for the callback are at minimum (those three are always received). Handling errors must be performed within the callback, because errors could be delayed from the server, and not visible immediately at launch time.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Note that the callback does not terminate the program on errors. This is done on purpose in order to demonstrate some common asynchronous problems below. The timestamp function is a small utility function to return a pointer to a string, representing the number of seconds because the program started (useful to visualize the order of the different asynchronous events below). glib-dbus-async/client-stubs.c&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Note that the callback does not terminate the program on errors. This is done on purpose in order to demonstrate some common asynchronous problems below. The timestamp function is a small utility function to return a pointer to a string, representing the number of seconds because the program started (useful to visualize the order of the different asynchronous events below). &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[http://vcs.maemo.org/svn/maemoexamples/trunk/glib-dbus-async/client-stubs.c &lt;/ins&gt;glib-dbus-async/client-stubs.c&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 178:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 178:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Using the stub code is rather simple. For each generated synchronous version of a method wrapper, there is also the a _async version of the call. The main difference with the parameters is the removal of the &amp;lt;code&amp;gt;GError&amp;lt;/code&amp;gt; pointer (because errors are handled in the callback), and the addition of the callback function to use when the method completes, times out or encounters an error.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Using the stub code is rather simple. For each generated synchronous version of a method wrapper, there is also the a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;&lt;/ins&gt;_async&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/code&amp;gt; &lt;/ins&gt;version of the call. The main difference with the parameters is the removal of the &amp;lt;code&amp;gt;GError&amp;lt;/code&amp;gt; pointer (because errors are handled in the callback), and the addition of the callback function to use when the method completes, times out or encounters an error.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The main function remains the same from the previous client examples (a once-per-second timer is created and run from the mainloop until the program is terminated).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The main function remains the same from the previous client examples (a once-per-second timer is created and run from the mainloop until the program is terminated).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 324:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 324:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Starting with some known generated stub code to see which parts can possibly be reused with some modifications is usually the easiest solution. This is shown in the last step of this example, in order to make a version of the asynchronous client that works without the stub generator.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Starting with some known generated stub code to see which parts can possibly be reused with some modifications is usually the easiest solution. This is shown in the last step of this example, in order to make a version of the asynchronous client that works without the stub generator.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The first step is to take a peek at the stub-generated code for the &amp;lt;code&amp;gt;setvalue1&amp;lt;/code&amp;gt; call (when used asynchronously): glib-dbus-async/value-client-stub.h&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The first step is to take a peek at the stub-generated code for the &amp;lt;code&amp;gt;setvalue1&amp;lt;/code&amp;gt; call (when used asynchronously): &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[http://vcs.maemo.org/svn/maemoexamples/trunk/glib-dbus-async/value-client-stub.h &lt;/ins&gt;glib-dbus-async/value-client-stub.h&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 362:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 362:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;What is notable in the code snippet above is that the _async method creates a temporary small structure that holds the pointer to the callback function and a copy of the userdata pointer. This small structure is then passed to &amp;lt;code&amp;gt;dbus_g_proxy_begin_call&amp;lt;/code&amp;gt;, along with the address of the generated callback wrapper function (&amp;lt;code&amp;gt;org_maemo_Value_setvalue1_async_callback&amp;lt;/code&amp;gt;). The GLib async launcher also takes a function pointer to a function to be used when the supplied &amp;quot;user-data&amp;quot; (in this case, the small structure) needs to be disposed of after the call. Because it uses &amp;lt;code&amp;gt;g_new&amp;lt;/code&amp;gt; to allocate the small structure, it passes &amp;lt;code&amp;gt;g_free&amp;lt;/code&amp;gt; as the freeing function. Next comes the argument specification for the method call, which obeys the same rules as the LibOSSO ones.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;What is notable in the code snippet above is that the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;&lt;/ins&gt;_async&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/code&amp;gt; &lt;/ins&gt;method creates a temporary small structure that holds the pointer to the callback function and a copy of the userdata pointer. This small structure is then passed to &amp;lt;code&amp;gt;dbus_g_proxy_begin_call&amp;lt;/code&amp;gt;, along with the address of the generated callback wrapper function (&amp;lt;code&amp;gt;org_maemo_Value_setvalue1_async_callback&amp;lt;/code&amp;gt;). The GLib async launcher also takes a function pointer to a function to be used when the supplied &amp;quot;user-data&amp;quot; (in this case, the small structure) needs to be disposed of after the call. Because it uses &amp;lt;code&amp;gt;g_new&amp;lt;/code&amp;gt; to allocate the small structure, it passes &amp;lt;code&amp;gt;g_free&amp;lt;/code&amp;gt; as the freeing function. Next comes the argument specification for the method call, which obeys the same rules as the LibOSSO ones.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On RPC completion, the generated callback is invoked and it gets the real callback function pointer and the userdata as its &amp;quot;user-data&amp;quot; parameter. Firs it collects the exit code for the call with &amp;lt;code&amp;gt;dbus_g_proxy_end_call&amp;lt;/code&amp;gt;, unpacks the data and invokes the real callback. After returning, the GLib wrappers (which called the generated callback) calls g_free to release the small structure, and the whole RPC launch ends.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On RPC completion, the generated callback is invoked and it gets the real callback function pointer and the userdata as its &amp;quot;user-data&amp;quot; parameter. Firs it collects the exit code for the call with &amp;lt;code&amp;gt;dbus_g_proxy_end_call&amp;lt;/code&amp;gt;, unpacks the data and invokes the real callback. After returning, the GLib wrappers (which called the generated callback) calls g_free to release the small structure, and the whole RPC launch ends.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 368:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 368:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The next step is to re-implement pretty much the same logic, but also dispose of the small structure because the callback is implemented directly, not as a wrapper-callback (it also omits the need for one memory allocation and one free).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The next step is to re-implement pretty much the same logic, but also dispose of the small structure because the callback is implemented directly, not as a wrapper-callback (it also omits the need for one memory allocation and one free).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The first step for that is to implement the RPC asynchronous launch code: glib-dbus-async/client-glib.c&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The first step for that is to implement the RPC asynchronous launch code: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[http://vcs.maemo.org/svn/maemoexamples/trunk/glib-dbus-async/client-glib.c &lt;/ins&gt;glib-dbus-async/client-glib.c&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 413:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 413:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;And the callback that is invoked on method call completion timeouts or errors: glib-dbus-async/client-glib.c&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;And the callback that is invoked on method call completion timeouts or errors: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[http://vcs.maemo.org/svn/maemoexamples/trunk/glib-dbus-async/client-glib.c &lt;/ins&gt;glib-dbus-async/client-glib.c&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 457:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 457:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The generated stub code is no longer needed, so the dependency rules for the stubless GLib version are different: glib-dbus-async/Makefile&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The generated stub code is no longer needed, so the dependency rules for the stubless GLib version are different: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[http://vcs.maemo.org/svn/maemoexamples/trunk/glib-dbus-async/Makefile &lt;/ins&gt;glib-dbus-async/Makefile&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;make&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;make&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-10 19:05:57 --&gt;
&lt;/table&gt;</description>
			<pubDate>Mon, 06 Sep 2010 10:29:50 GMT</pubDate>			<dc:creator>amigadave</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus</comments>		</item>
		<item>
			<title>amigadave:&amp;#32;/* Asynchronicity in D-Bus clients */ add link</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=38324&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=38324&amp;oldid=prev</guid>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Asynchronicity in D-Bus clients:&amp;#32;&lt;/span&gt; add link&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 10:12, 6 September 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The example code used below can be found in the [https://garage.maemo.org/svn/maemoexamples/trunk/glib-dbus-signals/ garage svn].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The example code used below can be found in the [https://garage.maemo.org/svn/maemoexamples/trunk/glib-dbus-signals/ garage svn].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;Asynchronicity in D-Bus clients ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Asynchronicity in D-Bus clients ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So far all the RPC method calls that have been implemented here have been &amp;quot;fast&amp;quot;, meaning that their execution has not depended on an access to slow services or external resources. In real life, however, it is quite likely that some services cannot be provided immediately, but have to wait for some external service to complete, before completing the method call.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;So far all the RPC method calls that have been implemented here have been &amp;quot;fast&amp;quot;, meaning that their execution has not depended on an access to slow services or external resources. In real life, however, it is quite likely that some services cannot be provided immediately, but have to wait for some external service to complete, before completing the method call.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The GLib wrappers provide a version of making method calls, where the call is launched (almost) immediately, and a callback is executed when the method call returns (either with a return value or an error).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[Documentation/Maemo 5 Developer Guide/DBus/Using GLib Wrappers For D-Bus|&lt;/ins&gt;GLib wrappers&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]] &lt;/ins&gt;provide a version of making method calls, where the call is launched (almost) immediately, and a callback is executed when the method call returns (either with a return value or an error).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Using the asynchronous wrappers is important when the program needs to update some kind of status or be reactive to the user (via a GUI or other interface). Otherwise, the program would block waiting for the RPC method to return, and would not be able to refresh the GUI or screen when required. An alternative solution is to use separate threads that run the synchronous methods. However, if this solution is used, synchronization between threads can become an issue, and debugging threaded programs is much harder than debugging single-threaded ones. Furthermore, the implementation of threads might be suboptimal in some environments. For these reasons, the thread scenario is not covered in this guide.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Using the asynchronous wrappers is important when the program needs to update some kind of status or be reactive to the user (via a GUI or other interface). Otherwise, the program would block waiting for the RPC method to return, and would not be able to refresh the GUI or screen when required. An alternative solution is to use separate threads that run the synchronous methods. However, if this solution is used, synchronization between threads can become an issue, and debugging threaded programs is much harder than debugging single-threaded ones. Furthermore, the implementation of threads might be suboptimal in some environments. For these reasons, the thread scenario is not covered in this guide.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-10 19:05:57 --&gt;
&lt;/table&gt;</description>
			<pubDate>Mon, 06 Sep 2010 10:12:44 GMT</pubDate>			<dc:creator>amigadave</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus</comments>		</item>
		<item>
			<title>amigadave:&amp;#32;use &lt;code&gt;</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=37844&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=37844&amp;oldid=prev</guid>
			<description>&lt;p&gt;use &amp;lt;code&amp;gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 09:00, 17 August 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 178:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 178:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Using the stub code is rather simple. For each generated synchronous version of a method wrapper, there is also the a _async version of the call. The main difference with the parameters is the removal of the GError pointer (because errors are handled in the callback), and the addition of the callback function to use when the method completes, times out or encounters an error.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Using the stub code is rather simple. For each generated synchronous version of a method wrapper, there is also the a _async version of the call. The main difference with the parameters is the removal of the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;&lt;/ins&gt;GError&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/code&amp;gt; &lt;/ins&gt;pointer (because errors are handled in the callback), and the addition of the callback function to use when the method completes, times out or encounters an error.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The main function remains the same from the previous client examples (a once-per-second timer is created and run from the mainloop until the program is terminated).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The main function remains the same from the previous client examples (a once-per-second timer is created and run from the mainloop until the program is terminated).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;Problems with Asynchronicity ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Problems with Asynchronicity ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When the simple test program is built and run, it can be seen that everything starts off quite well. But at some point, problems start to appear:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When the simple test program is built and run, it can be seen that everything starts off quite well. But at some point, problems start to appear:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 362:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 362:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;What is notable in the code snippet above is that the _async method creates a temporary small structure that holds the pointer to the callback function and a copy of the userdata pointer. This small structure is then passed to dbus_g_proxy_begin_call, along with the address of the generated callback wrapper function (org_maemo_Value_setvalue1_async_callback). The GLib async launcher also takes a function pointer to a function to be used when the supplied &amp;quot;user-data&amp;quot; (in this case, the small structure) needs to be disposed of after the call. Because it uses g_new to allocate the small structure, it passes g_free as the freeing function. Next comes the argument specification for the method call, which obeys the same rules as the LibOSSO ones.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;What is notable in the code snippet above is that the _async method creates a temporary small structure that holds the pointer to the callback function and a copy of the userdata pointer. This small structure is then passed to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;&lt;/ins&gt;dbus_g_proxy_begin_call&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/code&amp;gt;&lt;/ins&gt;, along with the address of the generated callback wrapper function (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;&lt;/ins&gt;org_maemo_Value_setvalue1_async_callback&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/code&amp;gt;&lt;/ins&gt;). The GLib async launcher also takes a function pointer to a function to be used when the supplied &amp;quot;user-data&amp;quot; (in this case, the small structure) needs to be disposed of after the call. Because it uses &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;&lt;/ins&gt;g_new&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/code&amp;gt; &lt;/ins&gt;to allocate the small structure, it passes &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;&lt;/ins&gt;g_free&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/code&amp;gt; &lt;/ins&gt;as the freeing function. Next comes the argument specification for the method call, which obeys the same rules as the LibOSSO ones.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On RPC completion, the generated callback is invoked and it gets the real callback function pointer and the userdata as its &amp;quot;user-data&amp;quot; parameter. Firs it collects the exit code for the call with dbus_g_proxy_end_call, unpacks the data and invokes the real callback. After returning, the GLib wrappers (which called the generated callback) calls g_free to release the small structure, and the whole RPC launch ends.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On RPC completion, the generated callback is invoked and it gets the real callback function pointer and the userdata as its &amp;quot;user-data&amp;quot; parameter. Firs it collects the exit code for the call with &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;code&amp;gt;&lt;/ins&gt;dbus_g_proxy_end_call&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/code&amp;gt;&lt;/ins&gt;, unpacks the data and invokes the real callback. After returning, the GLib wrappers (which called the generated callback) calls g_free to release the small structure, and the whole RPC launch ends.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The next step is to re-implement pretty much the same logic, but also dispose of the small structure because the callback is implemented directly, not as a wrapper-callback (it also omits the need for one memory allocation and one free).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The next step is to re-implement pretty much the same logic, but also dispose of the small structure because the callback is implemented directly, not as a wrapper-callback (it also omits the need for one memory allocation and one free).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-10 19:05:58 --&gt;
&lt;/table&gt;</description>
			<pubDate>Tue, 17 Aug 2010 09:00:59 GMT</pubDate>			<dc:creator>amigadave</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus</comments>		</item>
		<item>
			<title>amigadave:&amp;#32;wikify slightly, use &lt;source&gt;</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=37210&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=37210&amp;oldid=prev</guid>
			<description>&lt;p&gt;wikify slightly, use &amp;lt;source&amp;gt;&lt;/p&gt;
&lt;a href=&quot;http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;amp;diff=37210&amp;amp;oldid=29320&quot;&gt;Show changes&lt;/a&gt;</description>
			<pubDate>Thu, 22 Jul 2010 10:27:15 GMT</pubDate>			<dc:creator>amigadave</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus</comments>		</item>
		<item>
			<title>amigadave:&amp;#32;categorise</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=29320&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=29320&amp;oldid=prev</guid>
			<description>&lt;p&gt;categorise&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 12:06, 12 February 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 457:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 457:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Since the example program logic has not changed from the previous version, testing client-glib is not presented here (it can of course be tested if so desired, because the source code contains the fully working program). This version of the client also launches the method calls without waiting for previous method calls to complete.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Since the example program logic has not changed from the previous version, testing client-glib is not presented here (it can of course be tested if so desired, because the source code contains the fully working program). This version of the client also launches the method calls without waiting for previous method calls to complete.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Development]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Documentation]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Fremantle]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-10 19:06:00 --&gt;
&lt;/table&gt;</description>
			<pubDate>Fri, 12 Feb 2010 12:06:48 GMT</pubDate>			<dc:creator>amigadave</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus</comments>		</item>
		<item>
			<title>liox_lang_valid:&amp;#32;/* Asynchronous Method Calls Using GLib Wrappers */</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=18207&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=18207&amp;oldid=prev</guid>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Asynchronous Method Calls Using GLib Wrappers&lt;/span&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 08:53, 16 September 2009&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 316:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 316:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Asynchronous Method Calls Using GLib Wrappers ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Asynchronous Method Calls Using GLib Wrappers ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Sometimes the interface XML &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will be &lt;/del&gt;missing, so the dbus-bindings-tool cannot be run to generate the stub code. The GLib wrappers are generic enough to enable building own method calls, when necessary.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Sometimes the interface XML &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;missing, so the dbus-bindings-tool cannot be run to generate the stub code. The GLib wrappers are generic enough to enable building own method calls, when necessary.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;It is often easiest to start &lt;/del&gt;with some known generated stub code to see&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;which parts can possibly be reused with some modifications. This &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is what &lt;/del&gt;is shown in the last step of this example, in order to make a version of the asynchronous client that &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will work &lt;/del&gt;without the stub generator.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Starting &lt;/ins&gt;with some known generated stub code to see which parts can possibly be reused with some modifications &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is usually the easiest solution&lt;/ins&gt;. This is shown in the last step of this example, in order to make a version of the asynchronous client that &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;works &lt;/ins&gt;without the stub generator.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The first step is to take a peek at the stub-generated code for the setvalue1 call (when used asynchronously): glib-dbus-async/value-client-stub.h&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The first step is to take a peek at the stub-generated code for the setvalue1 call (when used asynchronously): glib-dbus-async/value-client-stub.h&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 356:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 356:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;}&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;}&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;What is notable in the code snippet above is that the _async method &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will create &lt;/del&gt;a temporary small structure that &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will hold &lt;/del&gt;the pointer to the callback function&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;and a copy of the userdata pointer. This small structure &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;then &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;be &lt;/del&gt;passed to dbus_g_proxy_begin_call, along with the address of the generated callback wrapper function (org_maemo_Value_setvalue1_async_callback). The GLib async launcher &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;also &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;take &lt;/del&gt;a function pointer to a function to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;use &lt;/del&gt;when the supplied &amp;quot;user-data&amp;quot; (in this case, the small structure) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will need &lt;/del&gt;to be disposed of after the call. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Since &lt;/del&gt;it uses g_new to allocate the small structure, it passes g_free as the freeing function. Next comes the argument specification for the method call, which obeys the same rules as the LibOSSO ones &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;before&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;What is notable in the code snippet above is that the _async method &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;creates &lt;/ins&gt;a temporary small structure that &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;holds &lt;/ins&gt;the pointer to the callback function and a copy of the userdata pointer. This small structure &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;then passed to dbus_g_proxy_begin_call, along with the address of the generated callback wrapper function (org_maemo_Value_setvalue1_async_callback). The GLib async launcher also &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;takes &lt;/ins&gt;a function pointer to a function to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;be used &lt;/ins&gt;when the supplied &amp;quot;user-data&amp;quot; (in this case, the small structure) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;needs &lt;/ins&gt;to be disposed of after the call. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Because &lt;/ins&gt;it uses g_new to allocate the small structure, it passes g_free as the freeing function. Next comes the argument specification for the method call, which obeys the same rules as the LibOSSO ones.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On RPC completion, the generated callback &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will be &lt;/del&gt;invoked&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;and it &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will get &lt;/del&gt;the real callback function pointer and the userdata as its &amp;quot;user-data&amp;quot; parameter. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;It will first collect &lt;/del&gt;the exit code for the call with dbus_g_proxy_end_call, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;unpack &lt;/del&gt;the data and &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;invoke &lt;/del&gt;the real callback. After returning, the GLib wrappers (which called the generated callback) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will call &lt;/del&gt;g_free to release the small structure, and the whole RPC launch &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will end&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;On RPC completion, the generated callback &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;invoked and it &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;gets &lt;/ins&gt;the real callback function pointer and the userdata as its &amp;quot;user-data&amp;quot; parameter. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Firs it collects &lt;/ins&gt;the exit code for the call with dbus_g_proxy_end_call, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;unpacks &lt;/ins&gt;the data and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;invokes &lt;/ins&gt;the real callback. After returning, the GLib wrappers (which called the generated callback) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;calls &lt;/ins&gt;g_free to release the small structure, and the whole RPC launch &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;ends&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The next step is to re-implement pretty much the same logic, but also dispose of the small structure&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, since &lt;/del&gt;the callback &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will be &lt;/del&gt;implemented directly, not as a wrapper-callback (it also omits the need for one memory allocation and one free).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The next step is to re-implement pretty much the same logic, but also dispose of the small structure &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;because &lt;/ins&gt;the callback &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;implemented directly, not as a wrapper-callback (it also omits the need for one memory allocation and one free).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The first step for that is to implement the RPC asynchronous launch code: glib-dbus-async/client-glib.c&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The first step for that is to implement the RPC asynchronous launch code: glib-dbus-async/client-glib.c&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 405:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 405:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;}&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;}&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;And the callback that &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will be &lt;/del&gt;invoked on method call completion&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;timeouts or errors: glib-dbus-async/client-glib.c&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;And the callback that &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;invoked on method call completion timeouts or errors: glib-dbus-async/client-glib.c&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;tt&amp;gt;&amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/**&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;tt&amp;gt;&amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/**&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * This function &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will be &lt;/del&gt;called when the async setvalue1 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;either&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * This function &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;called when the async setvalue1 either&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;complete&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;timeout &lt;/del&gt;or &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;fail &lt;/del&gt;(same as before). The main difference in&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;completes&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;timeouts &lt;/ins&gt;or &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;fails &lt;/ins&gt;(same as before). The main difference in&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * using GLib/D-Bus wrappers is that we need to &amp;quot;collect&amp;quot; the return&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * using GLib/D-Bus wrappers is that we need to &amp;quot;collect&amp;quot; the return&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * value (or error). This is done with the _end_call function.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * value (or error). This is done with the _end_call function.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 447:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 447:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;}&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;}&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The generated stub code is no longer needed, so the dependency rules for the stubless GLib version &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will also be somewhat &lt;/del&gt;different: glib-dbus-async/Makefile&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The generated stub code is no longer needed, so the dependency rules for the stubless GLib version &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;are &lt;/ins&gt;different: glib-dbus-async/Makefile&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;tt&amp;gt;client-glib&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; client-glib&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;o&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;tt&amp;gt;client-glib&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;:&amp;lt;/nowiki&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; client-glib&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;o&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 456:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 456:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Since the example program logic has not changed from the previous version, testing client-glib is not presented here (it can of course be tested if so desired, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;since &lt;/del&gt;the source code contains the fully working program). This version of the client &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;also &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;launch &lt;/del&gt;the method calls without waiting for previous method calls to complete.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Since the example program logic has not changed from the previous version, testing client-glib is not presented here (it can of course be tested if so desired, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;because &lt;/ins&gt;the source code contains the fully working program). This version of the client also &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;launches &lt;/ins&gt;the method calls without waiting for previous method calls to complete.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-10 19:06:00 --&gt;
&lt;/table&gt;</description>
			<pubDate>Wed, 16 Sep 2009 08:53:49 GMT</pubDate>			<dc:creator>liox_lang_valid</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus</comments>		</item>
		<item>
			<title>liox_lang_valid:&amp;#32;/* Problems with Asynchronicity */</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=18206&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=18206&amp;oldid=prev</guid>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Problems with Asynchronicity&lt;/span&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 08:47, 16 September 2009&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 182:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 182:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Problems with Asynchronicity ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Problems with Asynchronicity ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When the simple test program is built and run, it can be seen that everything starts off quite well. But at some point, problems &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;start to appear:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When the simple test program is built and run, it can be seen that everything starts off quite well. But at some point, problems start to appear:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;code&amp;gt;[sbox-FREMANTLE_X86: /glib-dbus-async] &amp;amp;gt; make client-stubs&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;code&amp;gt;[sbox-FREMANTLE_X86: /glib-dbus-async] &amp;amp;gt; make client-stubs&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 302:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 302:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ...&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ...&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;What happens above is rather subtle. The timer callback in the client launches once per second and performs the RPC method launch. The server, however, still has the 5 second delay for each method call in it. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;It can be seen that the &lt;/del&gt;successive launches go on without any responses for a while. The first response comes back at about 6 seconds from the starting of the client. At this point, the server already has four other outstanding method calls that it has not handled. Slowly the method calls are accumulating at the server end&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;and it does not deal with them quickly enough to satisfy the client.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;What happens above is rather subtle. The timer callback in the client launches once per second and performs the RPC method launch. The server, however, still has the 5 second delay for each method call in it. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The &lt;/ins&gt;successive launches go on without any responses for a while. The first response comes back at about 6 seconds from the starting of the client. At this point, the server already has four other outstanding method calls that it has not handled. Slowly the method calls are accumulating at the server end and it does not deal with them quickly enough to satisfy the client.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After about 30 seconds, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;it can be seen how &lt;/del&gt;the setValue1Completed callback is invoked, but the method call fails. This has managed to trigger the method call timeout mechanism. After this point, all the method calls that have accumulated into the server (into a message queue) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;fail in the client, since they all &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will now &lt;/del&gt;return late, even if the server actually does handle them.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;After about 30 seconds, the setValue1Completed callback is invoked, but the method call fails. This has managed to trigger the method call timeout mechanism. After this point, all the method calls that have accumulated into the server (into a message queue) fail in the client, since they all return late &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;now&lt;/ins&gt;, even if the server actually does handle them.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Once the client is terminated, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;it can be seen that &lt;/del&gt;the server is still happily continuing serving the requests, oblivious to the fact that there is no client to process the responses.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Once the client is terminated, the server is still happily continuing serving the requests, oblivious to the fact that there is no client to process the responses.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The above test demonstrates quite brutally that the services need to be designed properly, so that there is a clearly defined protocol what to do in case a method call is delayed. It is also advisable to design a notification protocol to tell clients that something has completed, instead of forcing them to time out. Using D-Bus signals is one way, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;but it is necessary to take care &lt;/del&gt;not &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;to generate signals, &lt;/del&gt;when &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;tere &lt;/del&gt;is &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;nothing &lt;/del&gt;listening to them. This can be done by only sending signals when &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;an &lt;/del&gt;long operation finishes (assuming this has been documented as part of the service description).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The above test demonstrates quite brutally that the services need to be designed properly, so that there is a clearly defined protocol what to do in case a method call is delayed. It is also advisable to design a notification protocol to tell clients that something has completed, instead of forcing them to time out. Using D-Bus signals is one way&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;. However&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;signals must &lt;/ins&gt;not &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;be generated &lt;/ins&gt;when &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;nothing &lt;/ins&gt;is listening to them. This can be done by only sending signals when &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;a &lt;/ins&gt;long operation finishes (assuming this has been documented as part of the service description).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;One partial fix &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;would be &lt;/del&gt;for the client to track and make sure that only one method call to one service is outstanding at any given time. So, instead of just blindly launching the RPC methods, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;it &lt;/del&gt;should defer from launching&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;if it has not yet received a response from the server (and the call has not timed out).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;One partial fix &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;for the client to track and make sure that only one method call to one service is outstanding at any given time. So, instead of just blindly launching the RPC methods, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the client &lt;/ins&gt;should defer from launching &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;RPC methods &lt;/ins&gt;if it has not yet received a response from the server (and the call has not timed out).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;However, this fix is not complete, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;since &lt;/del&gt;the same problem &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will manifest &lt;/del&gt;itself once there are multiple clients running in parallel and requesting the same methods. The proper fix is to make the server capable of serving multiple requests in parallel&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;. Some hints on how to do this are presented later on&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;However, this fix is not complete, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;because &lt;/ins&gt;the same problem &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;manifests &lt;/ins&gt;itself once there are multiple clients running in parallel and requesting the same methods. The proper fix is to make the server capable of serving multiple requests in parallel.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Asynchronous Method Calls Using GLib Wrappers ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Asynchronous Method Calls Using GLib Wrappers ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-10 19:06:00 --&gt;
&lt;/table&gt;</description>
			<pubDate>Wed, 16 Sep 2009 08:47:31 GMT</pubDate>			<dc:creator>liox_lang_valid</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus</comments>		</item>
		<item>
			<title>liox_lang_valid:&amp;#32;/* Asynchronous Method Calls Using Stubs */</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=18204&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=18204&amp;oldid=prev</guid>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Asynchronous Method Calls Using Stubs&lt;/span&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 08:40, 16 September 2009&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 99:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 99:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Asynchronous Method Calls Using Stubs ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Asynchronous Method Calls Using Stubs ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When the glib-bindings-tool is run, it &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;already &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;generate &lt;/del&gt;the necessary wrapping stubs to support launching asynchronous method calls. What is then left to do is implementing the callback functions correctly, processing the return errors and launching the method call. glib-dbus-async/client-stubs.c&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When the glib-bindings-tool is run, it already &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;generates &lt;/ins&gt;the necessary wrapping stubs to support launching asynchronous method calls. What is then left to do is implementing the callback functions correctly, processing the return errors and launching the method call. glib-dbus-async/client-stubs.c&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;tt&amp;gt;&amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/* Pull in the client stubs that were generated with&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;tt&amp;gt;&amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/* Pull in the client stubs that were generated with&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 108:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 108:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;tt&amp;gt;&amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/**&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;tt&amp;gt;&amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/**&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * This function &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will be &lt;/del&gt;called when the async setvalue1 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;either&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * This function &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;called when the async setvalue1 either&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;complete&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;timeout &lt;/del&gt;or &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;fail &lt;/del&gt;(our server however does not signal&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;completes&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;timeouts &lt;/ins&gt;or &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;fails &lt;/ins&gt;(our server however does not signal&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * errors, but the client D-Bus library &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;might&lt;/del&gt;). When this example&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * errors, but the client D-Bus library &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;can do that&lt;/ins&gt;). When this example&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * program is left running for a while, you &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;see all three cases.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * program is left running for a while, you &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;can &lt;/ins&gt;see all three cases.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; *&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; *&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * The prototype must match the one generated by the dbus-binding-tool&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * The prototype must match the one generated by the dbus-binding-tool&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * (org_maemo_Value_setvalue1_reply).&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * (org_maemo_Value_setvalue1_reply).&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; *&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; *&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Since &lt;/del&gt;there is no return value from the RPC, the only useful&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Because &lt;/ins&gt;there is no return value from the RPC, the only useful&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * parameter that we get is the error object, which we&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'ll &lt;/del&gt;check.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * parameter that we get is the error object, which we check.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * If error is NULL, that means no error. Otherwise the RPC call&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * If error is NULL, that means no error. Otherwise the RPC call&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * failed and we should check what the cause was.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * failed and we should check what the cause was.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 127:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 127:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#0000FF&amp;quot;&amp;gt;if&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;error &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; NULL&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;)&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;{&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#0000FF&amp;quot;&amp;gt;if&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;error &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; NULL&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;)&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;{&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#000000&amp;quot;&amp;gt;g_printerr&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;PROGNAME &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;quot;&amp;nbsp; &amp;nbsp; &amp;nbsp;  ERROR: %s&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#CC33CC&amp;quot;&amp;gt;\n&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;,&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; error&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;-&amp;amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;message&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;);&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#000000&amp;quot;&amp;gt;g_printerr&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;PROGNAME &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;quot;&amp;nbsp; &amp;nbsp; &amp;nbsp;  ERROR: %s&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#CC33CC&amp;quot;&amp;gt;\n&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;,&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; error&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;-&amp;amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;message&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;);&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/* We need to release the error object &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;since &lt;/del&gt;the stub code does&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/* We need to release the error object &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;because &lt;/ins&gt;the stub code does&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;  not do it automatically. */&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;  not do it automatically. */&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#000000&amp;quot;&amp;gt;g_error_free&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;error&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;);&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#000000&amp;quot;&amp;gt;g_error_free&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;error&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;);&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 135:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 135:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;}&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;}&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Since &lt;/del&gt;the method call does not return any data, the parameters for the callback are at minimum (those three &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;always &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;be &lt;/del&gt;received). Handling errors must be performed within the callback, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;since &lt;/del&gt;errors could be delayed from the server, and not visible immediately at launch time. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;N.B. The &lt;/del&gt;callback &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;not terminate the program on errors. This is done on purpose in order to demonstrate some common asynchronous problems below. The timestamp function is a small utility function to return a pointer to a string, representing the number of seconds &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;since &lt;/del&gt;the program started (useful to visualize the order of the different asynchronous events below). glib-dbus-async/client-stubs.c&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Because &lt;/ins&gt;the method call does not return any data, the parameters for the callback are at minimum (those three &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;are &lt;/ins&gt;always received). Handling errors must be performed within the callback, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;because &lt;/ins&gt;errors could be delayed from the server, and not visible immediately at launch time.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Note that the &lt;/ins&gt;callback &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;does &lt;/ins&gt;not terminate the program on errors. This is done on purpose in order to demonstrate some common asynchronous problems below. The timestamp function is a small utility function to return a pointer to a string, representing the number of seconds &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;because &lt;/ins&gt;the program started (useful to visualize the order of the different asynchronous events below). glib-dbus-async/client-stubs.c&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;tt&amp;gt;&amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/**&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;tt&amp;gt;&amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/**&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * This function &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will be &lt;/del&gt;called repeatedly from within the mainloop&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * This function &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;called repeatedly from within the mainloop&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * timer launch code.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * timer launch code.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; *&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; *&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * It &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will launch &lt;/del&gt;asynchronous RPC method to set value1 with ever&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * It &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;launches &lt;/ins&gt;asynchronous RPC method to set value1 with ever&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * increasing argument.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; * increasing argument.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; */&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt; */&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 150:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 152:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/* Start the RPC.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/* Start the RPC.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  This is done by calling the stub function that &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will take &lt;/del&gt;the new&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  This is done by calling the stub function that &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;takes &lt;/ins&gt;the new&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  value and the callback function to call on reply getting back.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  value and the callback function to call on reply getting back.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  The stub returns a DBusGProxyCall object, but we &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;don't &lt;/del&gt;need it&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  The stub returns a DBusGProxyCall object, but we &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;do not &lt;/ins&gt;need it&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  so we&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'ll &lt;/del&gt;ignore the return value. The return value could be used&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  so we ignore the return value. The return value could be used&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  to cancel a pending request (from client side) with&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  to cancel a pending request (from client side) with&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  dbus_g_proxy_cancel_call. We could also pass a pointer to&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  dbus_g_proxy_cancel_call. We could also pass a pointer to&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  user-data (last parameter), but we &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;don't &lt;/del&gt;need one in this example.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  user-data (last parameter), but we &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;do not &lt;/ins&gt;need one in this example.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  It &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;would &lt;/del&gt;normally &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;be &lt;/del&gt;used to &amp;quot;carry around&amp;quot; the application state.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  It &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;normally used to &amp;quot;carry around&amp;quot; the application state.&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  */&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  */&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#000000&amp;quot;&amp;gt;g_print&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;PROGNAME &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;quot;:%s:timerCallback launching setvalue1&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#CC33CC&amp;quot;&amp;gt;\n&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;,&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#000000&amp;quot;&amp;gt;g_print&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;PROGNAME &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;quot;:%s:timerCallback launching setvalue1&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#CC33CC&amp;quot;&amp;gt;\n&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;,&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 174:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 176:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;}&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;}&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Using the stub code is rather simple. For each generated synchronous version of a method wrapper, there &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will &lt;/del&gt;also &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;be &lt;/del&gt;a _async version of the call. The main difference with the parameters is the removal of the GError pointer (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;since &lt;/del&gt;errors &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will be &lt;/del&gt;handled in the callback), and the addition of the callback function to use when the method completes, times out or encounters an error.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Using the stub code is rather simple. For each generated synchronous version of a method wrapper, there &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;also &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/ins&gt;a _async version of the call. The main difference with the parameters is the removal of the GError pointer (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;because &lt;/ins&gt;errors &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;are &lt;/ins&gt;handled in the callback), and the addition of the callback function to use when the method completes, times out or encounters an error.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The main function remains the same from the previous client examples (a once-per-second timer &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will be &lt;/del&gt;created and run from the mainloop&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;until the program is terminated).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The main function remains the same from the previous client examples (a once-per-second timer &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;created and run from the mainloop until the program is terminated).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Problems with Asynchronicity ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Problems with Asynchronicity ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-10 19:06:01 --&gt;
&lt;/table&gt;</description>
			<pubDate>Wed, 16 Sep 2009 08:40:16 GMT</pubDate>			<dc:creator>liox_lang_valid</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus</comments>		</item>
		<item>
			<title>liox_lang_valid:&amp;#32;/* Slow Test Server */</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=18203&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus&amp;diff=18203&amp;oldid=prev</guid>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Slow Test Server&lt;/span&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 08:34, 16 September 2009&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 28:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 28:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#000000&amp;quot;&amp;gt;dbg&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;quot;Delaying operation&amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;);&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#000000&amp;quot;&amp;gt;dbg&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;quot;Delaying operation&amp;quot;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;);&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#000000&amp;quot;&amp;gt;g_usleep&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;SERVER_DELAY_USEC&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;);&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#000000&amp;quot;&amp;gt;g_usleep&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;SERVER_DELAY_USEC&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;);&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/* Compare the current value against old one. If they&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'re &lt;/del&gt;the same,&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;/* Compare the current value against old one. If they &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;are &lt;/ins&gt;the same,&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  we &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;don't &lt;/del&gt;need to do anything (except return success). */&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;lt;span&amp;gt;''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#9A1900&amp;quot;&amp;gt;&amp;nbsp; &amp;nbsp;  we &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;do not &lt;/ins&gt;need to do anything (except return success). */&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;''&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#0000FF&amp;quot;&amp;gt;if&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;obj&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;-&amp;amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;value1 &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; valueIn&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;)&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;{&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  &amp;lt;span&amp;gt;'''&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#0000FF&amp;quot;&amp;gt;if&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;'''&amp;lt;/span&amp;gt; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;(&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;obj&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;-&amp;amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;value1 &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; valueIn&amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#990000&amp;quot;&amp;gt;)&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span&amp;gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;{&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/tt&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Building the server is done as before, but we&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'ll &lt;/del&gt;notice the delay when we call an RPC method:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Building the server is done as before, but we notice the delay when we call an RPC method:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;div class=&amp;quot;graybox&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;div class=&amp;quot;graybox&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 62:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 62:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;In the example above, the time shell built-in command was used. It &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will run &lt;/del&gt;the given command while measuring the wall clock time (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;a.k.a. &lt;/del&gt;real time)&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;and time used while executing the code and system calls. In this case, only the real time is of any interest. The method call &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will delay &lt;/del&gt;for about 5 seconds, as it should. The delay (even &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;if &lt;/del&gt;given with microsecond resolution) is always approximate, and longer than the requested amount. Exact delay &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will depend &lt;/del&gt;on many factors, most of which cannot be directly influenced.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;In the example above, the time shell built-in command was used. It &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;runs &lt;/ins&gt;the given command while measuring the wall clock time (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/ins&gt;real time) and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/ins&gt;time used while executing the code and system calls. In this case, only the real time is of any interest. The method call &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;delays &lt;/ins&gt;for about 5 seconds, as it should. The delay (even &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;when &lt;/ins&gt;given with microsecond resolution) is always approximate, and longer than the requested amount. Exact delay &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;depends &lt;/ins&gt;on many factors, most of which cannot be directly influenced.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The next experiment deals with a likely scenario, where another method call comes along while the first one is still being executed. This is best tested by just repeating the sending command twice, but running the first one on the background (so that the shell does not wait for it to complete first). The server is still running on the background from the previous test:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The next experiment deals with a likely scenario, where another method call comes along while the first one is still being executed. This is best tested by just repeating the sending command twice, but running the first one on the background (so that the shell does not wait for it to complete first). The server is still running on the background from the previous test:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 93:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 93:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;What can be seen from the above output is that the first client is delayed for about 5 seconds, while the second client (which was launched shortly after the first) is already delayed by a much longer period. This is to be expected, as the server can only process one request at a time&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;and &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;will delay &lt;/del&gt;each request by 5 seconds.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;What can be seen from the above output is that the first client is delayed for about 5 seconds, while the second client (which was launched shortly after the first) is already delayed by a much longer period. This is to be expected, as the server can only process one request at a time and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;delays &lt;/ins&gt;each request by 5 seconds.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Some server concurrency issues will &lt;/del&gt;be &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;covered later, but for now, it is necessary that the clients are &lt;/del&gt;able to continue their &amp;quot;normal work&amp;quot; while they wait for the response from the server. Since this is just example code, &amp;quot;normal work&amp;quot; for &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;our &lt;/del&gt;clients &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;would be just &lt;/del&gt;waiting for the response&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;while blocking on incoming events (converted into callbacks). However, if the example programs &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;were &lt;/del&gt;graphical, the asynchronous approach &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;would &lt;/del&gt;make it possible for them to react to user input. D-Bus by itself does not support cancellation of method calls, once processing has started on the server side, so adding cancellation support &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;would require &lt;/del&gt;a separate method call to the server. Since the server only handles one operation at a time, the current server cannot support method call cancellations at all.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The clients must &lt;/ins&gt;be able to continue their &amp;quot;normal work&amp;quot; while they wait for the response from the server. Since this is just example code, &amp;quot;normal work&amp;quot; for &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the &lt;/ins&gt;clients &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is &lt;/ins&gt;waiting for the response while blocking on incoming events (converted into callbacks). However, if the example programs &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;are &lt;/ins&gt;graphical, the asynchronous approach make it possible for them to react to user input. D-Bus by itself does not support cancellation of method calls, once processing has started on the server side, so adding cancellation support &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;requires &lt;/ins&gt;a separate method call to the server. Since the server only handles one operation at a time, the current server cannot support method call cancellations at all.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Asynchronous Method Calls Using Stubs ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==&amp;nbsp; Asynchronous Method Calls Using Stubs ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-10 19:06:01 --&gt;
&lt;/table&gt;</description>
			<pubDate>Wed, 16 Sep 2009 08:34:03 GMT</pubDate>			<dc:creator>liox_lang_valid</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/Maemo_5_Developer_Guide/DBus/Asynchronous_Glib/D-Bus</comments>		</item>
	</channel>
</rss>