ライブラリ
キーワード
- ClosedQueueError (10)
- ConditionVariable (24)
- Context (12)
- Enumerator (12)
- ErrNoFinishedThread (6)
- ErrNoWaitingThread (6)
- Fiber (12)
- Location (12)
- Monitor (12)
- MultiTask (12)
- Mutex (20)
- Queue (24)
- SizedQueue (24)
- TCPServer (12)
- ThreadError (12)
- ThreadGroup (12)
- ThreadMember (12)
- ThreadsWait (6)
- WIN32OLE (12)
検索結果
-
Thread
:: Queue (3019.0) -
Queue はスレッド間の FIFO(first in first out) の通信路です。ス レッドが空のキューを読み出そうとすると停止します。キューになんら かの情報が書き込まれると実行は再開されます。
...と実行は再開されます。
最大サイズが指定できる Queue のサブクラス Thread::SizedQueue も提供されています。
=== 例
require 'thread'
q = Queue.new
th1 = Thread.start do
while resource = q.pop
puts resource
end
end
[:resource1, :resourc... -
Thread
:: Backtrace :: Location (3001.0) -
Ruby のフレームを表すクラスです。
...例1の実行結果:
caller_locations.rb:2:in `a'
caller_locations.rb:5:in `b'
caller_locations.rb:8:in `c'
//emlist[例2][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
p... -
Thread
:: Mutex (3001.0) -
Mutex(Mutal Exclusion = 相互排他ロック)は共有データを並行アクセスから保護する ためにあります。Mutex の典型的な使い方は(m を Mutex オブジェクトとします):
Mutex(Mutal Exclusion = 相互排他ロック)は共有データを並行アクセスから保護する
ためにあります。Mutex の典型的な使い方は(m を Mutex オブジェクトとします):
m.lock
begin
# m によって保護されたクリティカルセクション
ensure
m.unlock
end
または、より簡単に
m.synchronize {
# m によって保護されたクリティカルセクション
} -
Fiber (35.0)
-
ノンプリエンプティブな軽量スレッド(以下ファイバーと呼ぶ)を提供します。 他の言語では coroutine あるいは semicoroutine と呼ばれることもあります。 Thread と違いユーザレベルスレッドとして実装されています。
...ます。
他の言語では coroutine あるいは semicoroutine と呼ばれることもあります。
Thread と違いユーザレベルスレッドとして実装されています。
Thread クラスが表すスレッドと違い、明示的に指定しない限り
ファイバーのコンテ......=== 注意
Thread クラスが表すスレッド間をまたがるファイバーの切り替えはできません。
例外 FiberError が発生します。
//emlist[例:][ruby]{
f = nil
Thread.new do
f = Fiber.new{}
end.join
f.resume
#=> t.rb:5:in `resume': fiber called across threads (FiberEr... -
ClosedQueueError (33.0)
-
close 済みの Thread::Queue や Thread::SizedQueue に許可され ていない操作を行おうとした場合に発生する例外です。
...close 済みの Thread::Queue や Thread::SizedQueue に許可され
ていない操作を行おうとした場合に発生する例外です。... -
WIN32OLE (25.0)
-
OLEオートメーションサーバをRubyで操作するためのクラスです。
...ます。このため、
ruby 1.9以降のRubyのThreadとネイティブスレッドが1対1で対応する実行環境
ではスレッドをまたがる呼び出しはエラーとなります。
excel = WIN32OLE.new('Excel.Application')
Thread.start do
workbook = excel.Workbooks.Open('wor......kbook.xls') #=> HRESULT error code:0x800401f0
workbook.PrintOut
workbook.Close(:SaveChanges => false)
end.join
excel.Quit
発生するエラーはThreadの実行方法によって
0x800401f0(CO_E_NOTINITIALIZED)または0x8001010e(RPC_E_WRONG_THREAD)
です。... -
ConditionVariable (17.0)
-
Alias of Thread::ConditionVariable
...Alias of Thread::ConditionVariable... -
Mutex (17.0)
-
Alias of Thread::Mutex
...Alias of Thread::Mutex... -
Queue (17.0)
-
Alias of Thread::Queue
...Alias of Thread::Queue... -
Rake
:: MultiTask (17.0) -
通常のタスクと同じですが、thread を用いて事前タスクを並列実行します。
...通常のタスクと同じですが、thread を用いて事前タスクを並列実行します。...
