2

学習目的で、OSXでビジュアル プログラミングアプリケーションを構築しています。基本的には、出力 -> 入力を介して接続され、グラフを形成する 1 つの関数ノードで構成されます。

深さ優先検索を使用して (CoreData を使用して) 接続されたグラフを作成しています。次に、各ノードがグラフ キューで次のように実行されます。

NSTimeInterval secondsToFire = 1./250.;

NSString *dispatchName = [NSString stringWithFormat:@"info.oz432.timer.queue.%p", self];
dispatch_queue_t queue = dispatch_queue_create([dispatchName UTF8String], 0);

_timer = [self createWithInterval:secondsToFire inQueue:queue usingBlock:^{
    for (NSManagedObject *node in pipeline) {
        [self executeNode:[node objectID] inQueue:queue];
    }
}];

-createWithInterval:inQueue:usingBlock:

dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);

if (timer) {

    dispatch_source_set_timer(timer, dispatch_walltime(NULL, 0), interval * NSEC_PER_SEC, interval * NSEC_PER_SEC);
    dispatch_source_set_event_handler(timer, block);
    dispatch_resume(timer);

}

return timer;

今のところ問題なく動作していますが、次の点が気になります。

  • ReactiveCocoaを使用して信号を出力から入力に接続することが、最も単純で読みやすくパフォーマンスの高いソリューションである場合。
  • そうでなければ、なぜ'pipelines' ごとに NSRunLoopを実行することを選択する必要があるのでしょうか。

私はNSRunLoopについてたくさん読んだことがあります。Cocoa の GStreamer は NSRunLoop で管理しており、Vuoはそれを使用しています。基本的なことは理解できたと思います。しかし、私には理解できません。これが私の質問です。それにはどのような利点がありますか?

4

0 に答える 0