I am having issues with the following warning: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces. I am using an NSOperation object to perform some calculations, once complete it sends a message back to the AppDelegate that then hides a progress bar and unhides some buttons. If I comment out the message back to the Ap
Written by Mattt July 14th, 2014 This article has been translated into: 中文 In life, there’s always work to be done. Every day brings with it a steady stream of tasks and chores to fill the working hours of our existence. Yet, no matter how burdened one’s personal ToDo list becomes, it pales in comparison to the workload of an iOS app, of which millions of computations are expected, all while manag
無為空間 むいむい(´ω`*) Entries Snow LeopardとNSOperationQueue タグ: Objective-C Mac NSOperation Snow LeopardでGrand Central Dispatchが導入され、はたしてNSOperationQueueはどうなったのか。 Mac Dev Center: NSOperationQueue ClassReference In Mac OS X v10.6 and later, operation queues use the libdispatch library (also known as Grand Central Dispatch) to initiate the execution of their operations. 「Mac OS X 10.6以降のNSOperationQueueの中
Please note: this article is part of the older "Objective-C era" on Cocoa with Love. I don't keep these articles up-to-date; please be wary of broken code or potentially out-of-date information. Read "A new era for Cocoa with Love" for more. The Foundation framework provides all the tools you need for inter-thread communication — without needing to handling locks and synchronization yourself. I'll
I previously wrote a post about concurrent operations and how to use them for asynchronous APIs like NSURLConnection. Unfortunately, the code in that post originally contained a serious error that broke when running on 10.6 (I’ve since updated it). The API documentation for NSOperation mentions new behavior for concurrent operations: Note: In Mac OS X v10.6, operation queues ignore the value retur
NSOperation and NSOperationQueue are available on Leopard or the iPhone to help you parallelize your code. The idea is that if you have code that takes a long time to execute, you create an NSOperation subclass, override main, and put your long running code in there: @implementation CalculatePiOperation - (void)main { // Calculate PI to 1,000,000 digits } @end To execute an operation, you typicall
Intro As you may or may not know I recently did a talk at the Des Moines Cocoaheads in which I reviewed Blocks and Grand Central Dispatch. I have tried to capture the content of that talk and a lot more here in this article. The talk encompassed Blocks Grand Central Dispatch GCD Design Patterns Cocoa API's using GCD and BlocksAll of the content of this article applies only to Mac OS X 10.6 Snow Le
無為空間 むいむい(´ω`*) Entries NSOperationQueueとスレッドの関係 タグ: Objective-C Mac NSOperation NSOperationQueueを使ったプログラムをデバッグしていてふと気付いたのだが、NSOperationQueueは何もクソ真面目に「concurrentではない全てのoperationのために毎回スレッドを作っている」わけではないらしい。 例えば以下のコード。 @interface Operation : NSOperation { int number; } @property (nonatomic) int number; @end @implementation Operation @synthesize number; - (void)main { [NSThread sleepForTimeInterval:1]
前回はRSSフィードの一覧を読み込み、ダウンロードを行うところまで解説した。今回は、複数のフィードを並行してダウンロードするためのテクニックについて解説しよう。 NSOperationを使う 前回まででとりあえず、フィードをダウンロードできる。だが、このままではいささか使いづらい。RSSリーダでは、複数のフィードを一度にダウンロードすることが求められる。しかし、数十個のNSURLConnectionを一気に作成したら、帯域を食いつぶしてしまうだろう。同時に行うダウンロード数は、制限できるのが望ましい。1つのダウンロードが終わってから、次のダウンロードを行うようにするのだ。 Cocoaには、このような制御を行う仕組みがある。NSOperationとNSOperationQueueだ。NSOperationは、同時並行に行われる、それぞれの処理を表す。複数のNSOperationの処理を制御す
NSOperationってCoreAnimationみたいな派手な機能と違って、あまり解説されていない気がするので、使い方を書いておきます。オーディオのアプリケーションでも、読み込んだオーディオファイルの波形の画像をバックグラウンドで作っておいて、出来上がったら表示するみたいな事にも使えると思いますので。(※2008/5/12 記事にNSInvocationOperation等いろいろ修正を加えています。GCなしにも対応のはず。) NSOperationを使う NSOperationのサブクラスのmainメソッドにバックグラウンドで行いたい処理を記述しておき、そのインスタンス(以後、オペレーション)を作成して、NSOperationQueueのインスタンス(以後、キュー)のaddOperationメソッドに渡すと、あとは勝手にバックグラウンドで処理してくれます。キューへ渡した後にオペレーシ
さて、マルチコアを使い倒すためにはthreadを生成しなければならない。それを簡単にするためのNSOperationのお勉強。このFoundationのクラスは10.5 Leopardから使えるようになった。 Cocoaアプリでマルチコアに対応させるためにはこれまでNSThreadを使っていた。NSThreadはthreadの同期の機能はなく、自分でNSLockなどを使って実装する必要があった。注意深く作法を守らないと、つまらない理由のせいでデッドロックから抜け出せないコードになってしまうなんてことがよくある。 そのthread生成から同期、特に終了処理(子threadが全部終わるまで待つ)というのを肩代わりしてくれるのがNSOperationらしい。 マルチコアを使う用途だけでなく、ある程度時間のかかる処理をマルチスレッド化する場合にも使えるらしいので、以前数値計算のためにNSThrea
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く