大阪オフィスの山田です。久しぶりの執筆です。iOSアプリを開発する際のGCDを使った非同期処理について、理解があやふやだったので改めて調べて色々と試してみました。備忘録です。 GCDの基礎知識 GCDについて GCDとはGrand Central Dispatchの略です。ディスパッチキューにタスクを詰めると、タスクを実行してくれます。 キューのタスク処理について キューのタスク処理の方法は2種類あります。 Serial(直列) Concurrent(並列) Serialは、前のタスクが完了次第、次のタスクが実行されます。そのため、同時に実行されるタスクは1つです。Concurrentは、前のタスクの処理状況に関わらず、次のタスクが実行されます。 キューの種類について キューの種類は3つに分けられます。 Main Queue Serial(直列) Global Queue Concurre

Intro As you may or may not know I recently did a talk at the Des MoinesCocoaheads in which I reviewedBlocks and Grand Central Dispatch. I have tried to capture the content of that talk and a lot more here in this article. The talk encompassedBlocks Grand Central Dispatch GCD Design PatternsCocoaAPI's using GCD andBlocksAll of the content of this article applies only toMac OS X 10.6 Snow Le
Cocoaの並列処理(GCDとNSOperation/NSOperationQueue)に関するまとめです。この記事ではいわゆる「スレッド」については扱いません。スレッドについては、前に記事を書いたのでそちらを参照してください。Cocoaのマルチスレッドシステム - $ cat /var/log/shin スレッドによる並列処理からの脱却 スレッドは、歴史のある並列処理のための概念ですが、OSのカーネルの方にも密接に関わりがあるなど、抽象度は低めと言えます。 そこで、Cocoaでは、並列処理のための抽象度の高いインターフェースが提供されるようになりました。それがGCDとNSOperation/NSOperationQueueです。これらを使えば、スレッドを何個作成してタスクをどのように実行するか等の細かいことは、ランタイム側が全て決定してくれるので、ユーザは、並列処理したいタスクを定義し

+[NSURLConnection sendAsynchronousRequest:queue:completionHandler:] が何をしているか調べてみた TL; DR: +[NSURLConnection sendAsynchronousRequest:queue:completionHandler:] は dispatch_async で +[NSURLConnection sendSynchronousRequest:returningResponse:error:] を呼んでいる。 NSURLConnection を非同期に使いたいなんて要望はもうそれこそかなり昔からあって、数多の車輪の再発明とブログと FAQ が生まれたわけですが、一昨年の Grand Central Dispatch1、GCD の登場でついに抜本的な解決が見えるかのように見えてわひょーいってなった割には
11月末にAsyncUdpSocketのGCD対応版であるGCDAsyncUdpSocketが公開されていました。 過去に記事を書いたAsyncUdpSocketクラスを使うと、Cocoaアプリで簡単にUDP通信を実装できるのですが、今回はそれのGrand Central Dispatchに対応したバージョンが公開されていました。(TCP版であるGCDAsyncSocketは既に大分前にリリースされていました)2012年1月13日現在のリビジョンでは、ARCには対応していません。 GCDAsyncUdpSocketの入手 GCDAsyncUdpSocketはcocoaasyncsocketというプロジェクトの一部として開発されています。github上で開発/管理されているので、最新のソースコードをgithubからcloneしてきましょう。 git clone https://github.
Grand Central Dispatch AdvancediPhone Development - Fall 2010 - 12. Multithreading, multitasking, and GCD 3時間!にもおよぶマルチスレッドに関する授業のiTunes U“APPLICATION OF MODERN CONCURRENTPROGRAMMING” Grand Central DispatchとOpenCLの話NSURLConnection and grand central dispatch Grand Central Dispatch使って、非同期にNSURLConnectionを使う話Using Grand Central Dispatch データ取ってきてUITableViewで表示するアプリのコードに、Grand Central Dispatch使うコード入れて
Welcome back to another Friday Q&A. This week I continue the discussion of Grand Central Dispatch from the past two weeks. In the last two weeks I mainly focused on dispatch queues. This week I'mgoing to examine dispatch sources, how they work, and how to use them.Note that I assume you've already read the first two posts in this series. The first post is particularly important, the second one l
IntroductionWhenMac OS X 10.6 was introduced, theMacgot a very powerful duo of developer tools that made development on a lot easier. With iOS 4.0 developers finallygot access to these tools as well. These tools are known asBlocks & Grand Central Dispatch. This article is not an introduction to thesetechnologies as i've already covered them before here http://cocoasamurai.blogspot.com/2009/0
1リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く