<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A2 Apps &#187; GCD</title>
	<atom:link href="http://a2apps.com.au/tag/gcd/feed/" rel="self" type="application/rss+xml" />
	<link>http://a2apps.com.au</link>
	<description></description>
	<lastBuildDate>Sun, 10 Mar 2013 08:52:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Synchronous dispatch without deadlocking</title>
		<link>http://a2apps.com.au/synchronous-dispatch-without-deadlocking/</link>
		<comments>http://a2apps.com.au/synchronous-dispatch-without-deadlocking/#comments</comments>
		<pubDate>Mon, 04 Mar 2013 03:59:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[iOS Snippets]]></category>
		<category><![CDATA[GCD]]></category>

		<guid isPermaLink="false">http://a2apps.com.au/?p=104</guid>
		<description><![CDATA[Dispatches synchronously without deadlocking if the target thread is the current thread.]]></description>
				<content:encoded><![CDATA[<p>Dispatches synchronously without deadlocking if the target thread is the current thread.</p>
<pre class="brush: objc; title: ; notranslate">

static inline void dispatch_sync2(dispatch_queue_t queue, dispatch_block_t block) {
 if (dispatch_get_current_queue() == queue) {
 block();
 } else {
 dispatch_sync(queue, block);
 }
}

</pre>
]]></content:encoded>
			<wfw:commentRss>http://a2apps.com.au/synchronous-dispatch-without-deadlocking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running code on the UI thread</title>
		<link>http://a2apps.com.au/running-code-on-the-ui-thread/</link>
		<comments>http://a2apps.com.au/running-code-on-the-ui-thread/#comments</comments>
		<pubDate>Tue, 26 Feb 2013 13:10:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[iOS Snippets]]></category>
		<category><![CDATA[GCD]]></category>

		<guid isPermaLink="false">http://a2apps.com.au/?p=89</guid>
		<description><![CDATA[As an iOS developer you&#8217;ll get to see this all the time, since you have to be enormously careful when running code that does any UI processing; such code must always run in the main (UI) thread, so when running on a different thread it&#8217;s necessary to pass a block of code to be executed <a class="read-more-link" href="http://a2apps.com.au/running-code-on-the-ui-thread/"><br />...read more</a>]]></description>
				<content:encoded><![CDATA[<p>As an iOS developer you&#8217;ll get to see this all the time, since you have to be enormously careful when running code that does any UI processing; such code must always run in the main (UI) thread, so when running on a different thread it&#8217;s necessary to pass a block of code to be executed by the main thread:</p>
<pre class="brush: objc; title: ; notranslate">
dispatch_async(dispatch_get_main_queue(), ^{

// ... code to execute in main thread ...

});
</pre>
<p>dispatch_async() will run that code right away, asynchronously &#8211; ie, it will not wait to queue the code into the main queue. Use dispatch_sync() if you want to wait until it&#8217;s done &#8211; but be careful! If you target the current queue, it will result in a deadlock. More information <a href="https://developer.apple.com/library/mac/#documentation/Performance/Reference/GCD_libdispatch_Ref/Reference/reference.html">in the official documentation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://a2apps.com.au/running-code-on-the-ui-thread/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
