<?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: Cocoa Tutorial: NSOperation and NSOperationQueue</title>
	<atom:link href="http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/</link>
	<description>Taglines are for Windows programmers</description>
	<lastBuildDate>Mon, 05 Dec 2011 10:55:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1578</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Fri, 18 Mar 2011 16:53:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1578</guid>
		<description>&lt;p&gt;I highly suggest posting questions like this on stackoverflow.com.  You will get far more detailed answers.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I highly suggest posting questions like this on stackoverflow.com.  You will get far more detailed answers.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: abhisek</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1577</link>
		<dc:creator>abhisek</dc:creator>
		<pubDate>Fri, 18 Mar 2011 12:17:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1577</guid>
		<description>&lt;p&gt;If I&#039;m creating a big application and I need to declare an NSOperationQueue which can be accessible everywhere by all the Operations(Threads), where shall I do it. In AppDelegate(should it be static?) ? or in main.m ?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If I&#8217;m creating a big application and I need to declare an NSOperationQueue which can be accessible everywhere by all the Operations(Threads), where shall I do it. In AppDelegate(should it be static?) ? or in main.m ?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1576</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Thu, 17 Mar 2011 20:10:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1576</guid>
		<description>&lt;p&gt;static variables belong in the implementation file, not in the header.  -init is always called before anything else on the instance of the class. It initializes the instance after its memory has been allocated via -alloc.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>static variables belong in the implementation file, not in the header.  -init is always called before anything else on the instance of the class. It initializes the instance after its memory has been allocated via -alloc.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: abhisek</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1575</link>
		<dc:creator>abhisek</dc:creator>
		<pubDate>Thu, 17 Mar 2011 20:07:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1575</guid>
		<description>&lt;p&gt;Marcus,
       great tutorial. one questn. Why can&#039;t we define variables as static in @interface, likewise you defined static in @implementation. Also as I am new to cocoa I&#039;d like to knw if its sure that init in appdelegate will be called and will finish its work before applicationDidFinishLaunching is called??&lt;/p&gt;

&lt;p&gt;Regards,
Abhisek&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Marcus,
       great tutorial. one questn. Why can&#8217;t we define variables as static in @interface, likewise you defined static in @implementation. Also as I am new to cocoa I&#8217;d like to knw if its sure that init in appdelegate will be called and will finish its work before applicationDidFinishLaunching is called??</p>

<p>Regards,
Abhisek</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1564</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Thu, 10 Mar 2011 17:25:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1564</guid>
		<description>&lt;p&gt;Performance difference? No.  Safety yes.&lt;/p&gt;

&lt;p&gt;Yes an operation can be cancelled per the API.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Performance difference? No.  Safety yes.</p>

<p>Yes an operation can be cancelled per the API.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: chic</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1563</link>
		<dc:creator>chic</dc:creator>
		<pubDate>Thu, 10 Mar 2011 14:32:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1563</guid>
		<description>&lt;p&gt;thank you for this tutorial,&lt;/p&gt;

&lt;p&gt;I have 2 questions after it:
. is there big performance difference using nsoperation or nsthread
. is it possible to cancel the  operation, for example if user go back&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>thank you for this tutorial,</p>

<p>I have 2 questions after it:
. is there big performance difference using nsoperation or nsthread
. is it possible to cancel the  operation, for example if user go back</p>]]></content:encoded>
	</item>
	<item>
		<title>By: karthik</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1503</link>
		<dc:creator>karthik</dc:creator>
		<pubDate>Sat, 06 Nov 2010 16:57:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1503</guid>
		<description>&lt;p&gt;nice tutorial.Thanks&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>nice tutorial.Thanks</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1456</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Tue, 14 Sep 2010 15:18:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1456</guid>
		<description>&lt;p&gt;It is set to nil for a couple of reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;If something after that call tries to access the ivar then it will be a no op because it is nil rather than an exception because it is a reference to a released object.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In GC land, -release is a no op and setting an object to nil is a further guarantee that the GC will behave and decrease the reference count.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In either case it is extra protection for your code and a good habit to get into.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>It is set to nil for a couple of reasons:</p>

<ol>
<li><p>If something after that call tries to access the ivar then it will be a no op because it is nil rather than an exception because it is a reference to a released object.</p></li>
<li><p>In GC land, -release is a no op and setting an object to nil is a further guarantee that the GC will behave and decrease the reference count.</p></li>
</ol>

<p>In either case it is extra protection for your code and a good habit to get into.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: octy</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1455</link>
		<dc:creator>octy</dc:creator>
		<pubDate>Tue, 14 Sep 2010 14:03:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1455</guid>
		<description>&lt;p&gt;Hi Marcus,&lt;/p&gt;

&lt;p&gt;Great stuff, thanks for this post.&lt;/p&gt;

&lt;p&gt;I&#039;m wondering about one thing though... in the dealloc method (AppDelegate.m:41): why do you set the &lt;code&gt;queue&lt;/code&gt; pointer to nil? Isn&#039;t the pointer going away when dealloc is called? I&#039;m not nitpicking, just trying to understand a little bit more about object lifecycle in Objective-C.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Marcus,</p>

<p>Great stuff, thanks for this post.</p>

<p>I&#8217;m wondering about one thing though&#8230; in the dealloc method (AppDelegate.m:41): why do you set the <code>queue</code> pointer to nil? Isn&#8217;t the pointer going away when dealloc is called? I&#8217;m not nitpicking, just trying to understand a little bit more about object lifecycle in Objective-C.</p>

<p>Thanks!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1452</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Sat, 04 Sep 2010 17:42:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1452</guid>
		<description>&lt;p&gt;The &lt;code&gt;document&lt;/code&gt; is not leaked.  It is released after the main thread has completed.  Line 35 of &lt;code&gt;PageLoadOperation.m&lt;/code&gt; to be specific.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The <code>document</code> is not leaked.  It is released after the main thread has completed.  Line 35 of <code>PageLoadOperation.m</code> to be specific.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Eaglelouk</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1451</link>
		<dc:creator>Eaglelouk</dc:creator>
		<pubDate>Sat, 04 Sep 2010 17:38:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1451</guid>
		<description>&lt;p&gt;Seems that the NSXMLDocument is leaked. maybe you should use [document autorelease] when using performSelectorOnMainThread.&lt;/p&gt;

&lt;p&gt;Nice tuto anyway!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Seems that the NSXMLDocument is leaked. maybe you should use [document autorelease] when using performSelectorOnMainThread.</p>

<p>Nice tuto anyway!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: bguest</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1355</link>
		<dc:creator>bguest</dc:creator>
		<pubDate>Thu, 20 May 2010 15:28:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1355</guid>
		<description>&lt;p&gt;Very succinct tutorial, just what I needed, thank you.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Very succinct tutorial, just what I needed, thank you.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1088</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Sun, 23 Nov 2008 23:27:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1088</guid>
		<description>&lt;p&gt;The comma is used to chain commands together on one line.  That is all that it does and it is a part of the C language.  I use it when I do releases so that I do not forget to set the pointer to nil.  This is a bit of protective coding to avoid accidently send a message to a released object.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The comma is used to chain commands together on one line.  That is all that it does and it is a part of the C language.  I use it when I do releases so that I do not forget to set the pointer to nil.  This is a bit of protective coding to avoid accidently send a message to a released object.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: CharlesAHunter</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-1087</link>
		<dc:creator>CharlesAHunter</dc:creator>
		<pubDate>Sun, 23 Nov 2008 22:44:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-1087</guid>
		<description>&lt;p&gt;I am curious about the comma in your dealloc routine between the release of targetURL and the assignment to nil. I have never seen comma syntax in this situation before and am wondering whether I&#039;m missing something? (Kernighan &amp; Ritchie, 1978, Appendix A.7.15) gives an example of comma syntax in an expression of &quot;f(a,(t=3,t+2),c)&quot; saying that f() is being pass three arguments: a, 5 and c. However, that is not what appears to be going on in this dealloc routine. Is it just a typo that happens to compile or is it more significant?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I am curious about the comma in your dealloc routine between the release of targetURL and the assignment to nil. I have never seen comma syntax in this situation before and am wondering whether I&#8217;m missing something? (Kernighan &amp; Ritchie, 1978, Appendix A.7.15) gives an example of comma syntax in an expression of &#8220;f(a,(t=3,t+2),c)&#8221; saying that f() is being pass three arguments: a, 5 and c. However, that is not what appears to be going on in this dealloc routine. Is it just a typo that happens to compile or is it more significant?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-171</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Thu, 27 Mar 2008 15:00:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-171</guid>
		<description>&lt;p&gt;brg,&lt;/p&gt;

&lt;p&gt;performSelectorOnMainThread &quot;works&quot; just like any other message call.  It is a message that is passed to an object.  In this example it is passed to the static reference to the AppDelegate.  However it could easily have been passed to any other NSObject.  When the receiver gets the message, it then makes a subsequent call &lt;i&gt;to itself&lt;/i&gt; on the main thread using the selector that was passed in.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>brg,</p>

<p>performSelectorOnMainThread &#8220;works&#8221; just like any other message call.  It is a message that is passed to an object.  In this example it is passed to the static reference to the AppDelegate.  However it could easily have been passed to any other NSObject.  When the receiver gets the message, it then makes a subsequent call <i>to itself</i> on the main thread using the selector that was passed in.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: brg</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-165</link>
		<dc:creator>brg</dc:creator>
		<pubDate>Thu, 27 Mar 2008 12:25:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-165</guid>
		<description>&lt;p&gt;How does performSelectorOnMainThread work ?&lt;/p&gt;

&lt;p&gt;Does it multi-cast the call to any object that implements the pageLoaded method (thats running in the main thread)?&lt;/p&gt;

&lt;p&gt;Or does it have magic knowledge to send it to the AppDelegate?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>How does performSelectorOnMainThread work ?</p>

<p>Does it multi-cast the call to any object that implements the pageLoaded method (thats running in the main thread)?</p>

<p>Or does it have magic knowledge to send it to the AppDelegate?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: jpdann</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-51</link>
		<dc:creator>jpdann</dc:creator>
		<pubDate>Wed, 12 Mar 2008 18:51:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-51</guid>
		<description>&lt;p&gt;Of course, how stupid of me!  I should not post until I&#039;ve had a coffee.&lt;/p&gt;

&lt;p&gt;Thanks Marcus&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Of course, how stupid of me!  I should not post until I&#8217;ve had a coffee.</p>

<p>Thanks Marcus</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Zarra</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-48</link>
		<dc:creator>Marcus Zarra</dc:creator>
		<pubDate>Wed, 12 Mar 2008 16:04:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-48</guid>
		<description>&lt;p&gt;NSURL, like NSString, is immutable therefore no copy is necessary since it is not possible for a user to alter an immutable object.&lt;/p&gt;

&lt;p&gt;However, unlike NSString, NSURL does not have a mutable subclass so there is no concern.  Therefore if you wanted to be crazy you could check to see if your incoming NSString is mutable and decide on a copy vs retain.  But, I seriously down that the difference between a string copy vs. retain is going to save you a whole lot of memory.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>NSURL, like NSString, is immutable therefore no copy is necessary since it is not possible for a user to alter an immutable object.</p>

<p>However, unlike NSString, NSURL does not have a mutable subclass so there is no concern.  Therefore if you wanted to be crazy you could check to see if your incoming NSString is mutable and decide on a copy vs retain.  But, I seriously down that the difference between a string copy vs. retain is going to save you a whole lot of memory.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: jpdann</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-47</link>
		<dc:creator>jpdann</dc:creator>
		<pubDate>Wed, 12 Mar 2008 15:59:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-47</guid>
		<description>&lt;p&gt;Hi Marcus,&lt;/p&gt;

&lt;p&gt;I noticed that your targetURL property is retained instead of copied.  If you&#039;re going to be using this retained value in a new thread then why not copy it? Can the url change from under your feet, or does the NSOperation(Queue) system watch for that?&lt;/p&gt;

&lt;p&gt;I ask this as I have a routine that matches regexes in a large string, retaining the string would save memory, but the user can potentially edit the string in an NSTextView while the matching is taken place.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;/p&gt;

&lt;p&gt;Jon&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Marcus,</p>

<p>I noticed that your targetURL property is retained instead of copied.  If you&#8217;re going to be using this retained value in a new thread then why not copy it? Can the url change from under your feet, or does the NSOperation(Queue) system watch for that?</p>

<p>I ask this as I have a routine that matches regexes in a large string, retaining the string would save memory, but the user can potentially edit the string in an NSTextView while the matching is taken place.</p>

<p>Thanks,</p>

<p>Jon</p>]]></content:encoded>
	</item>
	<item>
		<title>By: jpdann</title>
		<link>http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/comment-page-1/#comment-37</link>
		<dc:creator>jpdann</dc:creator>
		<pubDate>Wed, 05 Mar 2008 23:22:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/#comment-37</guid>
		<description>&lt;p&gt;Hi Marcus,&lt;/p&gt;

&lt;p&gt;Thanks for the quick response.  Glad to know my coding style isn&#039;t completely off.&lt;/p&gt;

&lt;p&gt;Jon&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Marcus,</p>

<p>Thanks for the quick response.  Glad to know my coding style isn&#8217;t completely off.</p>

<p>Jon</p>]]></content:encoded>
	</item>
</channel>
</rss>

