るりまサーチ

最速Rubyリファレンスマニュアル検索!
208件ヒット [101-200件を表示] (0.191秒)
トップページ > クエリ:t[x] > クエリ:r[x] > 種類:インスタンスメソッド[x] > クエリ:ruby[x] > クエリ:@[x] > クラス:Thread[x]

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

検索結果

<< < 1 2 3 > >>

Thread#set_trace_func(pr) -> Proc | nil (12220.0)

スレッドにトレース用ハンドラを設定します。

...

//emlist[例][ruby]{
t
h = Thread.new do
class Trace
end
2.to_s
Thread
.current.set_trace_func nil
3.to_s
end
t
h.set_trace_func lambda {|*arg| p arg }
t
h.join

# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
# => ["c-call", "example.rb", 2, :inherited, #<Binding:...
...8de886770>, Class]
# => ["c-return", "example.rb", 2, :inherited, #<Binding:0x00007fc8de8844e8>, Class]
# => ["class", "example.rb", 2, nil, #<Binding:0x00007fc8de88e830>, nil]
# => ["end", "example.rb", 3, nil, #<Binding:0x00007fc8de88d6b0>, nil]
# => ["line", "example.rb", 4, nil, #<Binding:0x0000...
...ample.rb", 4, :to_s, #<Binding:0x00007fc8de896f30>, Integer]
# => ["c-return", "example.rb", 4, :to_s, #<Binding:0x00007fc8de894a50>, Integer]
# => ["line", "example.rb", 5, nil, #<Binding:0x00007fc8de967b08>, nil]
# => ["c-call", "example.rb", 5, :current, #<Binding:0x00007fc8de967798>, Thread]
# =...

Thread#abort_on_exception -> bool (12214.0)

真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、Thread#join などで検出されない限りそのスレッ ドだけをなにも警告を出さずに終了させます。

...スレッドで起こった例
外は、Thread#join などで検出されない限りそのスレッ
ドだけをなにも警告を出さずに終了させます。

デフォルトは偽です。c:Thread#exceptionを参照してください。

@
param newstate 自身を実行中に例外発生し...
...た場合、インタプリタ全体を終了させるかどうかを true か false で指定します。

//emlist[例][ruby]{
thread
= Thread.new { sleep 1 }
thread
.abort_on_exception # => false
thread
.abort_on_exception = true
thread
.abort_on_exception # => true
//}...

Thread#abort_on_exception=(newstate) (12214.0)

真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、Thread#join などで検出されない限りそのスレッ ドだけをなにも警告を出さずに終了させます。

...スレッドで起こった例
外は、Thread#join などで検出されない限りそのスレッ
ドだけをなにも警告を出さずに終了させます。

デフォルトは偽です。c:Thread#exceptionを参照してください。

@
param newstate 自身を実行中に例外発生し...
...た場合、インタプリタ全体を終了させるかどうかを true か false で指定します。

//emlist[例][ruby]{
thread
= Thread.new { sleep 1 }
thread
.abort_on_exception # => false
thread
.abort_on_exception = true
thread
.abort_on_exception # => true
//}...

Thread#ignore_deadlock=(bool) (12114.0)

デッドロック検知を無視する機能をon/offします。デフォルト値はfalseです。

...す。

t
rueを渡すとデッドロックを検知しなくなります。

//emlist[][ruby]{
Thread
.ignore_deadlock = true
queue = Thread::Queue.new

t
rap(:SIGUSR1){queue.push "Received signal"}

# ignore_deadlockがfalseだとエラーが発生する
puts queue.pop
//}

@
see Thread#ignore_deadloc...

Thread#fetch(name, default = nil) {|name| ... } -> object (9132.0)

name に関連づけられたスレッドに固有のデータを返します。 name に対応するスレッド固有データがない時には、引数 default が 与えられていればその値を、ブロックが与えられていれば そのブロックを評価した値を返します。

...時には、引数 default
与えられていればその値を、ブロックが与えられていれば
そのブロックを評価した値を返します。

@
param name スレッド固有データのキーを文字列か Symbol で指定します。
@
param default name に対応するスレ...
...す。
@
raise KeyError 引数defaultもブロックも与えられてない時、
name に対応するスレッド固有データがないと発生します。

//emlist[例][ruby]{
t
h = Thread.new { Thread.current[:name] = 'A' }
t
h.join
t
h.fetch(:name) # => "A"
t
h.fetch(:fetch, 'B...
...') # => "B"
t
h.fetch('name') {|name| "Thread" + name} # => "A"
t
h.fetch('fetch') {|name| "Thread" + name} # => "Threadfetch"
//}

@
see Thread#[]...

絞り込み条件を変える

Thread#run -> self (9120.0)

停止状態(stop)のスレッドを再開させます。 Thread#wakeup と異なりすぐにスレッドの切り替え を行います。

...状態(stop)のスレッドを再開させます。
Thread
#wakeup と異なりすぐにスレッドの切り替え
を行います。

@
raise ThreadError 死んでいるスレッドに対して実行すると発生します。

//emlist[例][ruby]{
a = Thread.new { puts "a"; Thread.stop; puts "c" }...
...sleep 0.1 while a.status!='sleep'
puts "Got here"
a.run
a.join
# => a
# => Got here
# => c
//}

@
see Thread#wakeup, Thread.stop...

Thread#stop? -> bool (9114.0)

スレッドが終了(dead)あるいは停止(stop)している時、true を返します。

...スレッドが終了(dead)あるいは停止(stop)している時、true を返します。

//emlist[例][ruby]{
a = Thread.new { Thread.stop }
b = Thread.current
a.stop? # => true
b.stop? # => false
//}

@
see Thread#alive?, Thread#status...

Thread#name=(name) -> String (6226.0)

self の名前を name に設定します。

...ームによっては pthread やカーネルにも設定を行う場合があります。

@
raise ArgumentError 引数に ASCII 互換ではないエンコーディングのものを
指定した場合に発生します。

//emlist[例][ruby]{
a = Thread.new{}
a.name = 'named'...
...a.name # => "named"
a.inspect # => "#<Thread:0x00007f85ac8721f0@named@(irb):1 dead>"
//}

@
see Thread#name...

Thread#[](name) -> object | nil (6132.0)

name に対応したスレッドに固有のデータを取り出します。 name に対応するスレッド固有データがなければ nil を返し ます。

...

@
param name スレッド固有データのキーを文字列か Symbol で指定します。

//emlist[例][ruby]{
[
Thread
.new { Thread.current["name"] = "A" },
Thread
.new { Thread.current[:name] = "B" },
Thread
.new { Thread.current["name"] = "C" }
].each do |th|
t
h.join
puts "#{th....
...inspect}: #{th[:name]}"
end

# => #<Thread:0x00000002a54220 dead>: A
# => #<Thread:0x00000002a541a8 dead>: B
# => #<Thread:0x00000002a54130 dead>: C
//}

Thread
#[] と Thread#[]= を用いたスレッド固有の変数は
Fiber を切り替えると異なる変数を返す事に注意してくだ...
...さい。

//emlist[][ruby]{
def meth(newvalue)
begin
oldvalue = Thread.current[:name]
Thread
.current[:name] = newvalue
yield
ensure
Thread
.current[:name] = oldvalue
end
end
//}

この関数に与えるブロックがFiberを切り替える場合は動的スコープとして...

Thread#wakeup -> self (6020.0)

停止状態(stop)のスレッドを実行可能状態(run)にします。

...top)のスレッドを実行可能状態(run)にします。

@
raise ThreadError 死んでいるスレッドに対して実行すると発生します。

//emlist[例][ruby]{
c = Thread.new { Thread.stop; puts "hey!" }
sleep 0.1 while c.status!='sleep'
c.wakeup
c.join
# => "hey!"
//}

@
see Thread#r...
...un, Thread.stop...

絞り込み条件を変える

Thread#key?(name) -> bool (6014.0)

name に対応したスレッドに固有のデータが定義されていれば true を返します。

...name に対応したスレッドに固有のデータが定義されていれば
t
rue を返します。

@
param name 文字列か Symbol で指定します。

//emlist[例][ruby]{
me = Thread.current
me[:oliver] = "a"
me.key?(:oliver) # => true
me.key?(:stanley) # => false
//}...
<< < 1 2 3 > >>