<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Lock Free Multithreading in Qt</title>
	<atom:link href="http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/feed/" rel="self" type="application/rss+xml" />
	<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/</link>
	<description>Your blog is probably better than mine.</description>
	<lastBuildDate>Tue, 07 Sep 2010 02:05:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Dave</title>
		<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/comment-page-1/#comment-103257</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Sun, 20 Jun 2010 03:10:28 +0000</pubDate>
		<guid isPermaLink="false">http://thesmithfam.org/blog/?p=472#comment-103257</guid>
		<description>Okay, it turns out that subclassing QThread is not actually necessary:

http://blog.exys.org/entries/2010/QThread_affinity.html

You don&#039;t have to write a run() method. You can just *have* a QThread in your class, and call start() on it. Then, call moveToThread(&amp;thread) rather than moveToThread(this).

Very interesting.</description>
		<content:encoded><![CDATA[<p>Okay, it turns out that subclassing QThread is not actually necessary:</p>
<p><a href="http://blog.exys.org/entries/2010/QThread_affinity.html" rel="nofollow">http://blog.exys.org/entries/2010/QThread_affinity.html</a></p>
<p>You don&#8217;t have to write a run() method. You can just *have* a QThread in your class, and call start() on it. Then, call moveToThread(&#038;thread) rather than moveToThread(this).</p>
<p>Very interesting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Victor Jetten</title>
		<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/comment-page-1/#comment-98827</link>
		<dc:creator>Victor Jetten</dc:creator>
		<pubDate>Sun, 21 Feb 2010 16:34:44 +0000</pubDate>
		<guid isPermaLink="false">http://thesmithfam.org/blog/?p=472#comment-98827</guid>
		<description>it works now, I had commented out &quot;movetothread(this)&quot;. Sorry for polluting your blog! ;-)</description>
		<content:encoded><![CDATA[<p>it works now, I had commented out &#8220;movetothread(this)&#8221;. Sorry for polluting your blog! ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Victor Jetten</title>
		<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/comment-page-1/#comment-98826</link>
		<dc:creator>Victor Jetten</dc:creator>
		<pubDate>Sun, 21 Feb 2010 16:24:09 +0000</pubDate>
		<guid isPermaLink="false">http://thesmithfam.org/blog/?p=472#comment-98826</guid>
		<description>sorry! I did not declare sowit under &quot;private slots:&quot; in the class, still getting the hang of this. However now that it runs it does not show every step in the counter, only the last one. I guess emit is not meant for passing values. I&#039;ll check what qtimer does</description>
		<content:encoded><![CDATA[<p>sorry! I did not declare sowit under &#8220;private slots:&#8221; in the class, still getting the hang of this. However now that it runs it does not show every step in the counter, only the last one. I guess emit is not meant for passing values. I&#8217;ll check what qtimer does</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/comment-page-1/#comment-98825</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Sun, 21 Feb 2010 16:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://thesmithfam.org/blog/?p=472#comment-98825</guid>
		<description>Oh, and a couple more things:

Is your method showit() declared as a &quot;slot&quot;, and not just &quot;public&quot;, like this:

public slots:
    showit(int i);

Is the show() signal declared as a signal in your thread class like this:

signals:
    show(int i);

Also, do you have Q_OBJECT in your Widget class declaration? (you need Q_OBJECT for any class that has signals or slots). You need Q_OBJECT in your thread class too.

If you add Q_OBJECT, you have to re-run &quot;qmake&quot; by the way.

--Dave</description>
		<content:encoded><![CDATA[<p>Oh, and a couple more things:</p>
<p>Is your method showit() declared as a &#8220;slot&#8221;, and not just &#8220;public&#8221;, like this:</p>
<p>public slots:<br />
    showit(int i);</p>
<p>Is the show() signal declared as a signal in your thread class like this:</p>
<p>signals:<br />
    show(int i);</p>
<p>Also, do you have Q_OBJECT in your Widget class declaration? (you need Q_OBJECT for any class that has signals or slots). You need Q_OBJECT in your thread class too.</p>
<p>If you add Q_OBJECT, you have to re-run &#8220;qmake&#8221; by the way.</p>
<p>&#8211;Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/comment-page-1/#comment-98824</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Sun, 21 Feb 2010 16:11:57 +0000</pubDate>
		<guid isPermaLink="false">http://thesmithfam.org/blog/?p=472#comment-98824</guid>
		<description>Victor, do you see any warnings on the command line when you run your app (on Windows, you need to add &quot;CONFIG += console&quot; to your .pro file). 

I ask because sometimes if you have a typo in your connect() call with your SIGNAL and SLOT text, you won&#039;t see an error in the compiler, but on the command line, you will see a warning when connect() is called.

Also, what is &quot;W&quot;? This should be your thread, not your widget, right?

Lastly, have you used qDebug()? Very handy. Just #include &lt;qtdebug&gt; and then you can add debug output like this:

qDebug() &lt;&lt; &quot;showit called with value&quot; &lt;&lt; i;

Let me know.&lt;/qtdebug&gt;</description>
		<content:encoded><![CDATA[<p>Victor, do you see any warnings on the command line when you run your app (on Windows, you need to add &#8220;CONFIG += console&#8221; to your .pro file). </p>
<p>I ask because sometimes if you have a typo in your connect() call with your SIGNAL and SLOT text, you won&#8217;t see an error in the compiler, but on the command line, you will see a warning when connect() is called.</p>
<p>Also, what is &#8220;W&#8221;? This should be your thread, not your widget, right?</p>
<p>Lastly, have you used qDebug()? Very handy. Just #include <qtdebug> and then you can add debug output like this:</p>
<p>qDebug() < < "showit called with value" << i;</p>
<p>Let me know.</qtdebug></qtdebug></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Victor Jetten</title>
		<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/comment-page-1/#comment-98823</link>
		<dc:creator>Victor Jetten</dc:creator>
		<pubDate>Sun, 21 Feb 2010 15:58:20 +0000</pubDate>
		<guid isPermaLink="false">http://thesmithfam.org/blog/?p=472#comment-98823</guid>
		<description>thanks for helping. Showit is nothing else but:
void mod6::showit(const int i)
{
	label-&gt;setNum(i);
}
where mod6 is the interface class. 
In the original prog the thread is a waterbalance model that can run for several hours and gives a lot of results back to the interface at each loop (values, a graph, digital maps). During the run the interface cannot block because the user may need to do things (zoom in and so on). I was also looking at the mandelbrot example in Qt but I liked your mutex-less example.</description>
		<content:encoded><![CDATA[<p>thanks for helping. Showit is nothing else but:<br />
void mod6::showit(const int i)<br />
{<br />
	label-&gt;setNum(i);<br />
}<br />
where mod6 is the interface class.<br />
In the original prog the thread is a waterbalance model that can run for several hours and gives a lot of results back to the interface at each loop (values, a graph, digital maps). During the run the interface cannot block because the user may need to do things (zoom in and so on). I was also looking at the mandelbrot example in Qt but I liked your mutex-less example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/comment-page-1/#comment-98819</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Sun, 21 Feb 2010 15:13:45 +0000</pubDate>
		<guid isPermaLink="false">http://thesmithfam.org/blog/?p=472#comment-98819</guid>
		<description>My first question is: are you sure you need a thread? It sounds like a QTimer would suffice. It&#039;s usually better to avoid threads if you can.

My other question is: what does the showit() method look like?</description>
		<content:encoded><![CDATA[<p>My first question is: are you sure you need a thread? It sounds like a QTimer would suffice. It&#8217;s usually better to avoid threads if you can.</p>
<p>My other question is: what does the showit() method look like?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Victor Jetten</title>
		<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/comment-page-1/#comment-98804</link>
		<dc:creator>Victor Jetten</dc:creator>
		<pubDate>Sun, 21 Feb 2010 08:35:27 +0000</pubDate>
		<guid isPermaLink="false">http://thesmithfam.org/blog/?p=472#comment-98804</guid>
		<description>Hi Dave, interesting article. Don&#039;t know if your blog is meant for direct help but here goes.
I am porting an application from borland and a newby to Qt. I can&#039;t get the emit to work. I have a main application with a widget, a button and a label (ui form), the on_button_clicked function declares and starts the thread &quot;W&quot; and each loop in the thread gives a result (an int) that has to be show on the label. so I have in the thread class:
signals:
   void show(const int i); 
in the widget class
  void showit(const int i);

which is linked as:
 connect(W, SIGNAL(show(int)),this, SLOT(showit(int)),    Qt::QueuedConnection);

When I debug the prog the thread is started and it runs 100 loops, each loop emits the counter to showit. The thread runs but nothing is shown. 
thanks.</description>
		<content:encoded><![CDATA[<p>Hi Dave, interesting article. Don&#8217;t know if your blog is meant for direct help but here goes.<br />
I am porting an application from borland and a newby to Qt. I can&#8217;t get the emit to work. I have a main application with a widget, a button and a label (ui form), the on_button_clicked function declares and starts the thread &#8220;W&#8221; and each loop in the thread gives a result (an int) that has to be show on the label. so I have in the thread class:<br />
signals:<br />
   void show(const int i);<br />
in the widget class<br />
  void showit(const int i);</p>
<p>which is linked as:<br />
 connect(W, SIGNAL(show(int)),this, SLOT(showit(int)),    Qt::QueuedConnection);</p>
<p>When I debug the prog the thread is started and it runs 100 loops, each loop emits the counter to showit. The thread runs but nothing is shown.<br />
thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/comment-page-1/#comment-98349</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Mon, 08 Feb 2010 06:03:09 +0000</pubDate>
		<guid isPermaLink="false">http://thesmithfam.org/blog/?p=472#comment-98349</guid>
		<description>Sal, your question prompted me to write another article on how to stop QThreads. Here you go:

http://thesmithfam.org/blog/2010/02/07/talking-to-qt-threads/

I hope that answers your question.</description>
		<content:encoded><![CDATA[<p>Sal, your question prompted me to write another article on how to stop QThreads. Here you go:</p>
<p><a href="http://thesmithfam.org/blog/2010/02/07/talking-to-qt-threads/" rel="nofollow">http://thesmithfam.org/blog/2010/02/07/talking-to-qt-threads/</a></p>
<p>I hope that answers your question.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sal</title>
		<link>http://thesmithfam.org/blog/2009/09/30/lock-free-multi-threading-in-qt/comment-page-1/#comment-98333</link>
		<dc:creator>Sal</dc:creator>
		<pubDate>Sun, 07 Feb 2010 21:09:02 +0000</pubDate>
		<guid isPermaLink="false">http://thesmithfam.org/blog/?p=472#comment-98333</guid>
		<description>What if you deal with a thread process that is continuous unless you specifically call it to either pause or stop.  One other triggering event is a close event, if thread running, then stop it gracefully?</description>
		<content:encoded><![CDATA[<p>What if you deal with a thread process that is continuous unless you specifically call it to either pause or stop.  One other triggering event is a close event, if thread running, then stop it gracefully?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
