<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments for My desperate life quest for efficiency</title>
	<link>http://efiquest.org</link>
	<description>(mostly in programming and *nix administration)</description>
	<pubDate>Wed, 10 Mar 2010 02:10:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>

	<item>
		<title>Comment on Using boost::threadpool with boost::future by pachanga</title>
		<link>http://efiquest.org/2009-12-10/40/#comment-641</link>
		<dc:creator>pachanga</dc:creator>
		<pubDate>Thu, 10 Dec 2009 06:59:24 +0000</pubDate>
		<guid>http://efiquest.org/2009-12-10/40/#comment-641</guid>
		<description>This should be very easy to achieve with a simple wrapper around the task. For example:

&lt;pre lang="cpp"&gt;
template&lt;typename Task, typename Callback
struct TaskWithNotification
{
  TaskWithNotification(Task t, Callback c)
    : task(t),
      callback(c)
  {}

  void operator()()
  {
     callback(task());
  }
};
&lt;/pre&gt;

...and the usage is straightforward:

&lt;pre lang="cpp"&gt;
submit_job(
   threadpool, 
   TaskWithNotification(
     boost::bind(LoadUserTask, userId), 
     boost::bind(OnUserLoad, _1))
);
&lt;/pre&gt;

In C++0x completion handler can be a lambda.</description>
		<content:encoded><![CDATA[<p>This should be very easy to achieve with a simple wrapper around the task. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">template</span><span style="color: #000080;">&lt;</span><span style="color: #0000ff;">typename</span> Task, <span style="color: #0000ff;">typename</span> Callback
<span style="color: #0000ff;">struct</span> TaskWithNotification
<span style="color: #008000;">&#123;</span>
  TaskWithNotification<span style="color: #008000;">&#40;</span>Task t, Callback c<span style="color: #008000;">&#41;</span>
    <span style="color: #008080;">:</span> task<span style="color: #008000;">&#40;</span>t<span style="color: #008000;">&#41;</span>,
      callback<span style="color: #008000;">&#40;</span>c<span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span><span style="color: #008000;">&#125;</span>
&nbsp;
  <span style="color: #0000ff;">void</span> operator<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
     callback<span style="color: #008000;">&#40;</span>task<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></pre></div></div>

<p>&#8230;and the usage is straightforward:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">submit_job<span style="color: #008000;">&#40;</span>
   threadpool, 
   TaskWithNotification<span style="color: #008000;">&#40;</span>
     boost<span style="color: #008080;">::</span><span style="color: #007788;">bind</span><span style="color: #008000;">&#40;</span>LoadUserTask, userId<span style="color: #008000;">&#41;</span>, 
     boost<span style="color: #008080;">::</span><span style="color: #007788;">bind</span><span style="color: #008000;">&#40;</span>OnUserLoad, _1<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>In C++0x completion handler can be a lambda.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using boost::threadpool with boost::future by Denis Bazhenov</title>
		<link>http://efiquest.org/2009-12-10/40/#comment-637</link>
		<dc:creator>Denis Bazhenov</dc:creator>
		<pubDate>Wed, 09 Dec 2009 23:45:25 +0000</pubDate>
		<guid>http://efiquest.org/2009-12-10/40/#comment-637</guid>
		<description>Conception of Futures very popular on Java Platform also. But there is one thing that I'm missing in Futures - asynchronous completition. Sometimes there is no need to wait for task to complete. All I need is to give task and completition function to thread pool. For example:

&lt;pre lang="java"&gt;
Callable task = new LoadUserTask(userId);
executor.submit(task, new CompletionHandler {
  public void onComplete(User user) {
    user.setLastLoginTime(now());
  }
});
&lt;/pre&gt;

Is there something similar in C++?</description>
		<content:encoded><![CDATA[<p>Conception of Futures very popular on Java Platform also. But there is one thing that I&#8217;m missing in Futures - asynchronous completition. Sometimes there is no need to wait for task to complete. All I need is to give task and completition function to thread pool. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">Callable task <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LoadUserTask<span style="color: #009900;">&#40;</span>userId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
executor.<span style="color: #006633;">submit</span><span style="color: #009900;">&#40;</span>task, <span style="color: #000000; font-weight: bold;">new</span> CompletionHandler <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onComplete<span style="color: #009900;">&#40;</span>User user<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    user.<span style="color: #006633;">setLastLoginTime</span><span style="color: #009900;">&#40;</span>now<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Is there something similar in C++?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Zveriki is the prize-winner of &#8220;The best online game&#8221; KRI2009-Award by pachanga</title>
		<link>http://efiquest.org/2009-05-19/37/#comment-375</link>
		<dc:creator>pachanga</dc:creator>
		<pubDate>Wed, 20 May 2009 05:18:16 +0000</pubDate>
		<guid>http://efiquest.org/2009-05-19/37/#comment-375</guid>
		<description>Thanks :D</description>
		<content:encoded><![CDATA[<p>Thanks <img src='http://efiquest.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Zveriki is the prize-winner of &#8220;The best online game&#8221; KRI2009-Award by .sid</title>
		<link>http://efiquest.org/2009-05-19/37/#comment-374</link>
		<dc:creator>.sid</dc:creator>
		<pubDate>Tue, 19 May 2009 22:15:54 +0000</pubDate>
		<guid>http://efiquest.org/2009-05-19/37/#comment-374</guid>
		<description>My congratulations.</description>
		<content:encoded><![CDATA[<p>My congratulations.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on A reliable way to serialize/unserialize objects in PHP by Autoload Magic &#124; Straylight Run</title>
		<link>http://efiquest.org/2007-12-10/6/#comment-365</link>
		<dc:creator>Autoload Magic &#124; Straylight Run</dc:creator>
		<pubDate>Thu, 07 May 2009 00:06:28 +0000</pubDate>
		<guid>http://efiquest.org/2007-12-10/6/#comment-365</guid>
		<description>[...] Use a special container class that all other classes inherit from. This method is suitable mostly when attempting to unserialize objects (when unserializing objects, PHP must have the class definition to recover the object). This special container will automatically know the class file for the contained object. Then, the only class file that needs to be located is the container&#8217;s class file. (Autoloading in the context of object un/serialization is a special case of class loading.) [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Use a special container class that all other classes inherit from. This method is suitable mostly when attempting to unserialize objects (when unserializing objects, PHP must have the class definition to recover the object). This special container will automatically know the class file for the contained object. Then, the only class file that needs to be located is the container&#8217;s class file. (Autoloading in the context of object un/serialization is a special case of class loading.) [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Announcing zveriki.com by pachanga</title>
		<link>http://efiquest.org/2008-08-25/30/#comment-282</link>
		<dc:creator>pachanga</dc:creator>
		<pubDate>Fri, 05 Sep 2008 05:36:06 +0000</pubDate>
		<guid>http://efiquest.org/2008-08-25/30/#comment-282</guid>
		<description>Oh, it's November 2008, of course. Thanks.</description>
		<content:encoded><![CDATA[<p>Oh, it&#8217;s November 2008, of course. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Announcing zveriki.com by Ilia M.</title>
		<link>http://efiquest.org/2008-08-25/30/#comment-281</link>
		<dc:creator>Ilia M.</dc:creator>
		<pubDate>Thu, 04 Sep 2008 22:18:22 +0000</pubDate>
		<guid>http://efiquest.org/2008-08-25/30/#comment-281</guid>
		<description>Do you really mean November 2008?</description>
		<content:encoded><![CDATA[<p>Do you really mean November 2008?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on vim automatic upward search for make and scons build scripts by pachanga</title>
		<link>http://efiquest.org/2007-10-08/11/#comment-259</link>
		<dc:creator>pachanga</dc:creator>
		<pubDate>Thu, 03 Apr 2008 04:27:16 +0000</pubDate>
		<guid>http://efiquest.org/2007-10-08/11/#comment-259</guid>
		<description>Yep, I'm currently a scons fan, however I'm also looking at CMake which is quite interesting for its ability to generate native build files(Makefile, KDevelop project, etc) for many platforms. This is really nice since end users won't have to install CMake in order to build the application - standard tools(like make) should suffice.</description>
		<content:encoded><![CDATA[<p>Yep, I&#8217;m currently a scons fan, however I&#8217;m also looking at CMake which is quite interesting for its ability to generate native build files(Makefile, KDevelop project, etc) for many platforms. This is really nice since end users won&#8217;t have to install CMake in order to build the application - standard tools(like make) should suffice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on vim automatic upward search for make and scons build scripts by Jim</title>
		<link>http://efiquest.org/2007-10-08/11/#comment-258</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Wed, 02 Apr 2008 19:56:02 +0000</pubDate>
		<guid>http://efiquest.org/2007-10-08/11/#comment-258</guid>
		<description>Thanks for the post! This is a really handy vim function. So I take it you prefer scons then to make? I discovered scons about the same time you posted this last year. Won't ever look back at make.</description>
		<content:encoded><![CDATA[<p>Thanks for the post! This is a really handy vim function. So I take it you prefer scons then to make? I discovered scons about the same time you posted this last year. Won&#8217;t ever look back at make.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on {{macro}} - a zillionth attempt to make a PHP template engine that sucks less by pachanga</title>
		<link>http://efiquest.org/2007-11-04/14/#comment-226</link>
		<dc:creator>pachanga</dc:creator>
		<pubDate>Mon, 17 Mar 2008 08:19:24 +0000</pubDate>
		<guid>http://efiquest.org/2007-11-04/14/#comment-226</guid>
		<description>Fixed, thanks!</description>
		<content:encoded><![CDATA[<p>Fixed, thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
