タグ

threadに関するketchupのブックマーク (5)

  • Thread-Safe Random Numbers (evanjones.ca)

    [ 2009-February-11 21:36 ] The C standard library function rand is not recommended to be used because older implementations were not very random. The newer function random is typically a better choice, particularly since you can call setstate to give it a large state array, which helps to generate better random numbers. However, neither of these are guaranteed to be thread-safe. That is, if you ca

    ketchup
    ketchup 2008/12/13
    スレッドセーフなランダム数生成
  • NSOperationによるバックグラウンド処理 - Objective-Audio

    NSOperationってCoreAnimationみたいな派手な機能と違って、あまり解説されていない気がするので、使い方を書いておきます。オーディオのアプリケーションでも、読み込んだオーディオファイルの波形の画像をバックグラウンドで作っておいて、出来上がったら表示するみたいな事にも使えると思いますので。(※2008/5/12 記事にNSInvocationOperation等いろいろ修正を加えています。GCなしにも対応のはず。) NSOperationを使う NSOperationのサブクラスのmainメソッドにバックグラウンドで行いたい処理を記述しておき、そのインスタンス(以後、オペレーション)を作成して、NSOperationQueueのインスタンス(以後、キュー)のaddOperationメソッドに渡すと、あとは勝手にバックグラウンドで処理してくれます。キューへ渡した後にオペレーシ

  • Multi-Threaded Debuggerが地味にスゴくて泣ける - marsのメモ

    この前その紹介記事見つけたんで,それを真似しながら実際動かしてみた。きしださんの例がちょうどよかったので,これを題材にしてみたよ。 Runner#run()の適当なところにブレイクポイント仕込んでデバッガを起動する。するとスレッドごとに同じ場所で止まるんで,こんな具合に教えてくれる(この時点ですでにスゴイ)。 適当なスレッド選んでステップ実行とかするわけなんだが,スレッドの一覧が表示されているんで,どんだけスレッドが起きてるとか,どのスレッドが止まってるとか丸分かり。さらにスレッド一覧の右端には,スレッドの停止・再開ボタンが付いているので,興味ないスレッドは先やっててみたいなことができる(スゴイよね)。 さらにダメ押しなのが,ステップ実行中に他のスレッドがどこで停止しているかも見える!!(超スゲぇ) 緑色の矢印&ハイライト行が現スレッドの実行位置で,歯車アイコンが他のスレッドの実行位置(停

    Multi-Threaded Debuggerが地味にスゴくて泣ける - marsのメモ
  • mikeash.com: Don't Use NSOperationQueue

    Book The Complete Friday Q&A, advanced topics in Mac OS X and iOS programming. GitHub My GitHub page, containing various open-source libraries for Mac and iOS development, and some miscellaneous projects

    ketchup
    ketchup 2008/12/13
    Quoted: I've been discussing this on cocoa-dev but wanted to make a separate post about it to get the word out further. NSOperationQueue is broken on ...
  • RAOperationQueue, an open-source replacement for NSOperationQueue

    Posted By Rogue Amoeba Alumni on December 1st, 2008 When we started on our first Leopard-only software, we were excited to to use NSOperationQueue, as it promised to greatly ease the pain of multithreading. And it lived up to its promise well, right up to the point where we discovered that it was fatally broken. (And I mean fatally broken. It spontaneously crashes. There’s no workaround and it’s u

    RAOperationQueue, an open-source replacement for NSOperationQueue
  • 1