<?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: Objective-C: Atomic, properties, threading and/or custom setter/getter</title>
	<atom:link href="http://www.friday.com/bbum/2008/01/13/objectivce-c-atomic-properties-threading-andor-custom-settergetter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.friday.com/bbum/2008/01/13/objectivce-c-atomic-properties-threading-andor-custom-settergetter/</link>
	<description>...so google can organize my head.</description>
	<pubDate>Sun, 07 Sep 2008 10:40:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Travis Cripps</title>
		<link>http://www.friday.com/bbum/2008/01/13/objectivce-c-atomic-properties-threading-andor-custom-settergetter/#comment-185225</link>
		<dc:creator>Travis Cripps</dc:creator>
		<pubDate>Tue, 05 Feb 2008 10:43:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/2008/01/13/objectivce-c-atomic-properties-threading-andor-custom-settergetter/#comment-185225</guid>
		<description>Nice post, Bill.  I appreciate your clear examples and explanation of the difference between atomic and thread safe.  Thanks.</description>
		<content:encoded><![CDATA[<p>Nice post, Bill.  I appreciate your clear examples and explanation of the difference between atomic and thread safe.  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Leppik</title>
		<link>http://www.friday.com/bbum/2008/01/13/objectivce-c-atomic-properties-threading-andor-custom-settergetter/#comment-184683</link>
		<dc:creator>David Leppik</dc:creator>
		<pubDate>Fri, 18 Jan 2008 16:57:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/2008/01/13/objectivce-c-atomic-properties-threading-andor-custom-settergetter/#comment-184683</guid>
		<description>Well, if you want to define things that way, no multithreaded code of any complexity is thread safe.  Typically, when one says that something is thread safe, it's actually less restrictive than being atomic.  Thread safe means that code works &lt;em&gt;as intended&lt;/em&gt; when called simultaneously from multiple threads.  When you're dealing with multithreaded code, you need to spell out your intentions very carefully.

Your name code is a perfect example.  You can make the fullName method atomic, but that won't help when someone needs a fullNameWithLastNameFirst method, or any of a zillion other variations.

I've been writing multithreaded code in Java for over a decade, and I firmly believe that 99% of the time accessors should &lt;b&gt;not&lt;/b&gt; be thread safe.  It just gives a misplaced sense of security.

For the Dude class, I'd make it explicitly thread unsafe, so that people using it won't be tempted to use the same Dude in multiple threads.  If you need to access it from multiple threads, you make copies of it.  If that's too inefficient for you, then you make its fields read-only.

They say that multithreaded programming is hard.  That's half true.  It's nigh impossible to debug when things go wrong. (Especially when the processor is allowed to execute code out-of-order in each thread.) But the trick to writing multithreaded programs is not to do anything clever. Simple, blunt rules (e.g. copy, don't share) get the job done every time.  And, thanks to the machine second-guessing you, they usually turn out to be more efficient than cleverness anyway.</description>
		<content:encoded><![CDATA[<p>Well, if you want to define things that way, no multithreaded code of any complexity is thread safe.  Typically, when one says that something is thread safe, it&#8217;s actually less restrictive than being atomic.  Thread safe means that code works <em>as intended</em> when called simultaneously from multiple threads.  When you&#8217;re dealing with multithreaded code, you need to spell out your intentions very carefully.</p>
<p>Your name code is a perfect example.  You can make the fullName method atomic, but that won&#8217;t help when someone needs a fullNameWithLastNameFirst method, or any of a zillion other variations.</p>
<p>I&#8217;ve been writing multithreaded code in Java for over a decade, and I firmly believe that 99% of the time accessors should <b>not</b> be thread safe.  It just gives a misplaced sense of security.</p>
<p>For the Dude class, I&#8217;d make it explicitly thread unsafe, so that people using it won&#8217;t be tempted to use the same Dude in multiple threads.  If you need to access it from multiple threads, you make copies of it.  If that&#8217;s too inefficient for you, then you make its fields read-only.</p>
<p>They say that multithreaded programming is hard.  That&#8217;s half true.  It&#8217;s nigh impossible to debug when things go wrong. (Especially when the processor is allowed to execute code out-of-order in each thread.) But the trick to writing multithreaded programs is not to do anything clever. Simple, blunt rules (e.g. copy, don&#8217;t share) get the job done every time.  And, thanks to the machine second-guessing you, they usually turn out to be more efficient than cleverness anyway.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin Stiglitz</title>
		<link>http://www.friday.com/bbum/2008/01/13/objectivce-c-atomic-properties-threading-andor-custom-settergetter/#comment-184617</link>
		<dc:creator>Benjamin Stiglitz</dc:creator>
		<pubDate>Mon, 14 Jan 2008 16:15:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.friday.com/bbum/2008/01/13/objectivce-c-atomic-properties-threading-andor-custom-settergetter/#comment-184617</guid>
		<description>While they don’t ensure consistency, atomic properties &lt;em&gt;do&lt;/em&gt; ensure that individual properties will have valid values; that is, that there will be no partially written values when read across threads.</description>
		<content:encoded><![CDATA[<p>While they don’t ensure consistency, atomic properties <em>do</em> ensure that individual properties will have valid values; that is, that there will be no partially written values when read across threads.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
