<?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"
	>
<channel>
	<title>Comments on: Threading and (py)Gtk</title>
	<atom:link href="http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/</link>
	<description>Who needs facts when you have anecdotal evidence?</description>
	<pubDate>Fri, 18 May 2012 02:21:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: zewexarneWene</title>
		<link>http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-36721</link>
		<dc:creator>zewexarneWene</dc:creator>
		<pubDate>Sat, 07 Jan 2012 05:34:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-36721</guid>
		<description>that it's got no time constraints. It is possible to log in at any point on the day, and you also understand that the net keepstart off up with websites to promote the items throughout the planet. Nonetheless it has been identified inside the recent periods thatbe viewed over the internet so you could choose for by yourself the purse you intend obtaining. On-line lookingcheated by pretend or replica goods. Can I Invest in a Chanel Bag On-line Chanel bags now want not essentially bemaintain a lot of things inside. The stitching from the totes is so intricate that you simply is not going to even find a way to find out it, &lt;a href="http://www.chanelbagsukstore.com" rel="nofollow"&gt;Chanel Flap Bag&lt;/a&gt; boasts of quilted leather development that is practically a signature of all Chanel purses.You will discover alsoan outstanding and acceptable alternative to getting to shell out the complete retail price tag tag on the principal retailObviously, the fulfillment of getting unique and genuine solutions within the official on the web retail store will comethat even if you get a applied bag, it will be in a very fantastic situation, simply because the past operator need tothe supplier supplied on their profiles, or determined by which seller is closer for your home, you may effortlessly filter</description>
		<content:encoded><![CDATA[<p>that it&#8217;s got no time constraints. It is possible to log in at any point on the day, and you also understand that the net keepstart off up with websites to promote the items throughout the planet. Nonetheless it has been identified inside the recent periods thatbe viewed over the internet so you could choose for by yourself the purse you intend obtaining. On-line lookingcheated by pretend or replica goods. Can I Invest in a Chanel Bag On-line Chanel bags now want not essentially bemaintain a lot of things inside. The stitching from the totes is so intricate that you simply is not going to even find a way to find out it, <a href="http://www.chanelbagsukstore.com" onclick="javascript:pageTracker._trackPageview('/www.chanelbagsukstore.com');" rel="nofollow">Chanel Flap Bag</a> boasts of quilted leather development that is practically a signature of all Chanel purses.You will discover alsoan outstanding and acceptable alternative to getting to shell out the complete retail price tag tag on the principal retailObviously, the fulfillment of getting unique and genuine solutions within the official on the web retail store will comethat even if you get a applied bag, it will be in a very fantastic situation, simply because the past operator need tothe supplier supplied on their profiles, or determined by which seller is closer for your home, you may effortlessly filter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Clumsleellilm</title>
		<link>http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-35715</link>
		<dc:creator>Clumsleellilm</dc:creator>
		<pubDate>Fri, 09 Dec 2011 17:59:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-35715</guid>
		<description>UGG. No matter how they had been referred to then, the finished result was which they have been genuinely divan to put on.To start with, UGG Boots are in vogue all over the planet. These comfortable and dry boots have proved to getRetailer. UGG Australia are extremely proud of their product or service and also to help customers have issued a listing of US &lt;a href="http://www.cheapuggsbootsshop.net" rel="nofollow"&gt;ugg boots sale&lt;/a&gt; minds of all those and genuine UGG boots makes your existence felt in a very crowd of fashion conscious celebrities.heat in chilly winter months and cool when the weather conditions gets heat. The gentle sheepskin insoles also make it possible for airfootwear inside the vogue trade. Walking in a pair of significant heels is actually tiresome and unpleasant. It also</description>
		<content:encoded><![CDATA[<p>UGG. No matter how they had been referred to then, the finished result was which they have been genuinely divan to put on.To start with, UGG Boots are in vogue all over the planet. These comfortable and dry boots have proved to getRetailer. UGG Australia are extremely proud of their product or service and also to help customers have issued a listing of US <a href="http://www.cheapuggsbootsshop.net" onclick="javascript:pageTracker._trackPageview('/www.cheapuggsbootsshop.net');" rel="nofollow">ugg boots sale</a> minds of all those and genuine UGG boots makes your existence felt in a very crowd of fashion conscious celebrities.heat in chilly winter months and cool when the weather conditions gets heat. The gentle sheepskin insoles also make it possible for airfootwear inside the vogue trade. Walking in a pair of significant heels is actually tiresome and unpleasant. It also</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kerncucherb</title>
		<link>http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-14212</link>
		<dc:creator>kerncucherb</dc:creator>
		<pubDate>Fri, 05 Oct 2007 18:03:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-14212</guid>
		<description>There's one special secret Sale link on Amazon: 
 
http://tinyurl.com/2r7ldr 
 
&lt;b&gt;This is open every Friday and ONLY on Fridays! &lt;/b&gt; 
 
You can find very good discounts here, although some Fridays you can really get 
lucky and make off like an Amazon bandit - I´ve seen discounts there as low as 75% 
off sticker Price.</description>
		<content:encoded><![CDATA[<p>There&#8217;s one special secret Sale link on Amazon: </p>
<p><a href="http://tinyurl.com/2r7ldr" onclick="javascript:pageTracker._trackPageview('/tinyurl.com');" rel="nofollow">http://tinyurl.com/2r7ldr</a> </p>
<p><b>This is open every Friday and ONLY on Fridays! </b> </p>
<p>You can find very good discounts here, although some Fridays you can really get<br />
lucky and make off like an Amazon bandit - I´ve seen discounts there as low as 75%<br />
off sticker Price.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Livingston</title>
		<link>http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-158</link>
		<dc:creator>James Livingston</dc:creator>
		<pubDate>Sun, 11 Mar 2007 21:42:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-158</guid>
		<description>I\'m not certain if PyGTK does things differently, but in C code signals get emitting in which ever thread runs the emit() function. Which is why you see such code calling emit() from an idle callback.

So using \'gobject.idle_add(self.emit, \"scan-completed\")\' is probably what you want to do.

&lt;em&gt;Thanks, this works perfectly&lt;/em&gt;</description>
		<content:encoded><![CDATA[<p>I\&#8217;m not certain if PyGTK does things differently, but in C code signals get emitting in which ever thread runs the emit() function. Which is why you see such code calling emit() from an idle callback.</p>
<p>So using \&#8217;gobject.idle_add(self.emit, \&#8221;scan-completed\&#8221;)\&#8217; is probably what you want to do.</p>
<p><em>Thanks, this works perfectly</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin Otte</title>
		<link>http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-157</link>
		<dc:creator>Benjamin Otte</dc:creator>
		<pubDate>Sun, 11 Mar 2007 21:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-157</guid>
		<description>I am 100% sure that the example is not thread-safe. The thread safety work in signals was related to the fact that glib doesn\'t crash anymore when another thread removes the object that is emitting the signal, but it didn\'t change threading semantics at all. It was in large part motivated by us GStreamer people who run the whole processing in different threads and would be very pissed if all our signals would be pushed into the main thread. ;)

If you wanna see your example app blow up, add a g_idle_add that spawns new threads. THat should be enough already to make it die.

&lt;em&gt;Thanks for your comment.  &lt;/em&gt;

&lt;em&gt;I made a correction suggested by James Livingston in the next comment. This fixed things. In my case (threads run a long time and dont really do much GUI manipulation the burden of signals going back to the main thread is not too troublesome. The following snippet in add_thread() now works fine.&lt;/em&gt;
&lt;em&gt;for i in range(0,5):
#make a thread and start it
data = random.randint(0,1000)
rowref = self.pendingModel.insert(0,(data,))

#THE ACTUAL THREAD BIT
#our threads data is just a single integer
#self.manager.make_thread(self.thread_finished,rowref,data)

gobject.idle_add(self.manager.make_thread,self.thread_finished,rowref,data)
&lt;/em&gt;</description>
		<content:encoded><![CDATA[<p>I am 100% sure that the example is not thread-safe. The thread safety work in signals was related to the fact that glib doesn\&#8217;t crash anymore when another thread removes the object that is emitting the signal, but it didn\&#8217;t change threading semantics at all. It was in large part motivated by us GStreamer people who run the whole processing in different threads and would be very pissed if all our signals would be pushed into the main thread. <img src='http://www.johnstowers.co.nz/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>If you wanna see your example app blow up, add a g_idle_add that spawns new threads. THat should be enough already to make it die.</p>
<p><em>Thanks for your comment.  </em></p>
<p><em>I made a correction suggested by James Livingston in the next comment. This fixed things. In my case (threads run a long time and dont really do much GUI manipulation the burden of signals going back to the main thread is not too troublesome. The following snippet in add_thread() now works fine.</em><br />
<em>for i in range(0,5):<br />
#make a thread and start it<br />
data = random.randint(0,1000)<br />
rowref = self.pendingModel.insert(0,(data,))</p>
<p>#THE ACTUAL THREAD BIT<br />
#our threads data is just a single integer<br />
#self.manager.make_thread(self.thread_finished,rowref,data)</p>
<p>gobject.idle_add(self.manager.make_thread,self.thread_finished,rowref,data)<br />
</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: voyou</title>
		<link>http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-156</link>
		<dc:creator>voyou</dc:creator>
		<pubDate>Sun, 11 Mar 2007 20:16:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-156</guid>
		<description>I hoped that was the case, as it seems like an elegant way to structure the code, but I don\'t think its true; it looks like signal handlers are called directly from emit(). Try getting your code to print thread.get_ident() in various different functions; at least when I tried it, the thread ident printed from the run method was the same ident printed from the callback, but different from the ident printed from the main thread. &lt;a rel=\"nofollow\" href=\"http://www.daa.com.au/pipermail/pygtk/2004-February/006941.html\" rel="nofollow"&gt;this thread on the pygtk list&lt;/a&gt; suggests that signal handlers don\'t get called in the main thread, although it\'s rather old and things may have changed since.

&lt;em&gt;Hmm, after sprinkling thread.get_ident() I think I agree. See the update and other comments&lt;/em&gt;</description>
		<content:encoded><![CDATA[<p>I hoped that was the case, as it seems like an elegant way to structure the code, but I don\&#8217;t think its true; it looks like signal handlers are called directly from emit(). Try getting your code to print thread.get_ident() in various different functions; at least when I tried it, the thread ident printed from the run method was the same ident printed from the callback, but different from the ident printed from the main thread. <a rel=\"nofollow\" href=\"http://www.daa.com.au/pipermail/pygtk/2004-February/006941.html\" rel="nofollow">this thread on the pygtk list</a> suggests that signal handlers don\&#8217;t get called in the main thread, although it\&#8217;s rather old and things may have changed since.</p>
<p><em>Hmm, after sprinkling thread.get_ident() I think I agree. See the update and other comments</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: voyou</title>
		<link>http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-155</link>
		<dc:creator>voyou</dc:creator>
		<pubDate>Sun, 11 Mar 2007 18:52:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-155</guid>
		<description>I\'m probably missing something, but this doesn\'t look thread safe. What happens if a thread completes (and so emits \"scan-completed\", thereby calling _register_thread_completed) while the main thread is in the middle of executing make_thread ? Isn\'t there the possibility of both threads accessing fooThreads at the same time?

&lt;em&gt;I was of the impression that it is only signal emission that is thread safe, and when the actual signal callbacks are run they are done so in the main thread. Because make_thread is also only ever called from the main thread I believe that this makes the approach thread safe. I would like to hear the thoughts of pygtk hackers on this one however.&lt;/em&gt;
&lt;p align=\"right\"&gt;&lt;em&gt;John&lt;/em&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>I\&#8217;m probably missing something, but this doesn\&#8217;t look thread safe. What happens if a thread completes (and so emits \&#8221;scan-completed\&#8221;, thereby calling _register_thread_completed) while the main thread is in the middle of executing make_thread ? Isn\&#8217;t there the possibility of both threads accessing fooThreads at the same time?</p>
<p><em>I was of the impression that it is only signal emission that is thread safe, and when the actual signal callbacks are run they are done so in the main thread. Because make_thread is also only ever called from the main thread I believe that this makes the approach thread safe. I would like to hear the thoughts of pygtk hackers on this one however.</em></p>
<p align=\"right\"><em>John</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jkgkljhj</title>
		<link>http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-154</link>
		<dc:creator>jkgkljhj</dc:creator>
		<pubDate>Sun, 11 Mar 2007 18:10:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-154</guid>
		<description>Heh, if you rename the file from FooThread.py to FooThread.py.txt, you don't even have to reconfigure your server and people can still read the source in their browser. Cool, eh?</description>
		<content:encoded><![CDATA[<p>Heh, if you rename the file from FooThread.py to FooThread.py.txt, you don&#8217;t even have to reconfigure your server and people can still read the source in their browser. Cool, eh?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adel</title>
		<link>http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-153</link>
		<dc:creator>adel</dc:creator>
		<pubDate>Sun, 11 Mar 2007 16:42:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnstowers.co.nz/blog/index.php/2007/03/12/threading-and-pygtk/#comment-153</guid>
		<description>Thank you</description>
		<content:encoded><![CDATA[<p>Thank you</p>
]]></content:encoded>
	</item>
</channel>
</rss>

