タグ

rubyとthreadに関するsecondlifeのブックマーク (4)

  • JRuby はじめました - ヽ( ・∀・)ノくまくまー(2009-06-30)

    1.8 のスレッドは? green thread (ユーザレベルスレッド) 1.9 でなんか変わったの? native thread (カーネルスレッド)になった おぉ、マルチコアの恩恵を受けて高速化!? いや、並行実行はしない どういうこと? 各スレッドを順番に少しずつ実行するけど、同時には実行しない え?じゃ、速度は... 1コアでも32コアCPUでも一緒 ちょw。それって1.8でも一緒じゃん。何で並行実行しないの? Rubyから使うCの拡張ライブラリを全部、並行処理に対応させる必要があるから それは大変そうだな。連絡付かない作者もいるだろうし 1.9 では動かなくなるライブラリがあるのを避けるために、native にしたけど並行化はしなかった 確かに、正しい選択だ。で、当は? 作業コストが大変だから(笑) ちょww。あれ?じゃあ green thread のままでも良かったんじゃね

    secondlife
    secondlife 2009/07/07
    "Q: 何が嬉しいのかを3行で!A: ググレ"
  • Background - opensource.imedo.de

    Background This Rails plugin lets you execute arbitrary Ruby blocks in a background process. In comparison to existing background processing frameworks, this plugin has many advantages: Responsibilities don't get cut out of objects (most of the time, the code running in the background process actually belongs to an object residing in the foreground process). This can be solved by delegating the t

  • http://files.rubyforge.vm.bytemark.co.uk/file-observer/file_change_observer.rb

    class FileChangeObserver fnf @files.delete file end end end def mtime_real file begin File.mtime file rescue => boom boom = FileNotFoundError.new unless File.exist?(file) raise end end end

    secondlife
    secondlife 2007/08/27
    なるほど、thread を継承して実装かぁ。
  • Threadのvalue - @m_seki の

    昨日のバリア同期書いてて思い出した。 Threadのvalueメソッド(joinとだいたい同じ)は、スレッドの終了を待って最後に評価した値を返します。スレッドがすでに終了してたらすぐに、まだ実行中なら終了するまでブロックしてから値を返してくれるし、何度でも返してくれます。待ち合わせて結果を回収する、という並行処理でよくある問題を簡単に解決してくれるデスよ。 と、主にid:secondlifeの人むけ。

    Threadのvalue - @m_seki の
  • 1