クラス
- Exception (12)
- Fiber (24)
- IO (120)
- Monitor (18)
- Mutex (6)
- Thread (186)
-
Thread
:: Mutex (40) - ThreadGroup (12)
- ThreadsWait (6)
- TracePoint (12)
モジュール
- Marshal (24)
- ObjectSpace (12)
- Process (24)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - Fiber (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - Thread (12)
- add (12)
-
backtrace
_ locations (12) -
clock
_ gettime (12) -
count
_ tdata _ objects (12) - detach (12)
- dump (24)
- eof (12)
- eof? (12)
- exit (12)
- fetch (8)
- fork (12)
-
handle
_ interrupt (12) - join (24)
- lock (12)
-
mon
_ exit (6) - name= (10)
- new (24)
-
next
_ wait (6) -
pending
_ interrupt? (12) - pipe (96)
- raise (12)
-
rb
_ thread _ raise (12) -
rb
_ thread _ raise _ m (12) -
rb
_ thread _ signal _ raise (12) -
report
_ on _ exception (18) -
report
_ on _ exception= (18) - resume (12)
-
rinda
/ rinda (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 4 feature (12) - run (12)
- sleep (12)
- start (12)
- status (12)
- synchronize (10)
- transfer (12)
- unlock (12)
- wakeup (12)
- スレッド (12)
検索結果
先頭5件
-
NEWS for Ruby 3
. 0 . 0 (36.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...`false`. 17371
//emlist{
0 => a
p a #=> 0
{b: 0, c: 1} => {b:}
p b #=> 0
//}
//emlist{
# version 3.0
0 in 1 #=> false
# version 2.7
0 in 1 #=> raise NoMatchingPatternError
//}
* Find-pattern is added. [EXPERIMENTAL]
16828
//emlist{
case ["a", 1, "b", "c", 2, "d", "e", "f", 3]
in [*pre,......ad of a LocalJumpError. 15575
* When a class variable is overtaken by the same definition in an
ancestor class/module, a RuntimeError is now raised (previously,
it only issued a warning in verbose mode). Additionally, accessing a
class variable from the toplevel scope is now a Runtim......M1.include M2
p C.ancestors #=> [C, M1, M2, Object, Kernel, BasicObject]
//}
* Mutex
* `Mutex` is now acquired per-`Fiber` instead of per-`Thread`. This change should be compatible for essentially all usages and avoids blocking when using a scheduler. 16792
* Proc
* Proc#== and Proc#eq... -
NEWS for Ruby 2
. 7 . 0 (30.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ュメントの識別子の引用符は同じ行で閉じる必要があります。
//emlist{
<<"EOS
" # This had been warned since 2.4; Now it raises a SyntaxError
EOS
//}
* フリップフロップが非推奨になったのが元に戻されました。 5400
* 以下のような場所に......子が単一の代入と同じ振る舞いになりました。 8279
//emlist[][ruby]{
a, b = raise rescue [1, 2]
# Previously parsed as: (a, b = raise) rescue [1, 2]
# Now parsed as: a, b = (raise rescue [1, 2])
//}
* 特異クラス構文での yield は警告を表示するように.......with_index(1) { |it, index| puts "#{index}:#{it}" }.take(3).force
# => 1:a
# 2:b
# 3:c
//}
* Fiber
* 新規メソッド
* Fiber#raiseメソッドが追加され、Fiber#resumeのように
resumeして、さらに例外を発生させます。 10344
* File
* 新規... -
Marshal
. # dump(obj , limit = -1) -> String (24.0) -
obj を指定された出力先に再帰的に出力します。
...スタンス。Dir, File::Stat, IO とそのサブクラス
File, Socket など。
* MatchData, Data, Method, UnboundMethod,
Proc, Thread, ThreadGroup, Continuation
のインスタンス。
* 特異メソッドを定義したオブジェクト
また、これらのオブジェクト......。
port を指定すると port を返します。
@raise TypeError ファイルに書き出せないオブジェクトをファイルに
書きだそうとした場合に発生します。
@raise ArgumentError 名前の付いていない Class や Module......オブジェクトをダンプしようとした場合に発生します。
@raise ArgumentError limit 段以上深くリンクしたオブジェクトをダンプしようと
した場合に発生します。
@see Object#marshal_dump, Object#marshal_load... -
Marshal
. # dump(obj , port , limit = -1) -> IO (24.0) -
obj を指定された出力先に再帰的に出力します。
...スタンス。Dir, File::Stat, IO とそのサブクラス
File, Socket など。
* MatchData, Data, Method, UnboundMethod,
Proc, Thread, ThreadGroup, Continuation
のインスタンス。
* 特異メソッドを定義したオブジェクト
また、これらのオブジェクト......。
port を指定すると port を返します。
@raise TypeError ファイルに書き出せないオブジェクトをファイルに
書きだそうとした場合に発生します。
@raise ArgumentError 名前の付いていない Class や Module......オブジェクトをダンプしようとした場合に発生します。
@raise ArgumentError limit 段以上深くリンクしたオブジェクトをダンプしようと
した場合に発生します。
@see Object#marshal_dump, Object#marshal_load... -
TracePoint
. new(*events) {|obj| . . . } -> TracePoint (24.0) -
新しい TracePoint オブジェクトを作成して返します。トレースを有効 にするには TracePoint#enable を実行してください。
...記述されたメソッド呼び出しからのリターン。
: :raise
例外の発生。
: :b_call
ブロックの開始。
: :b_return
ブロックの終了。
: :thread_begin
スレッドの開始。
: :thread_end
スレッドの終了。
指定イベントに関連しな......を実行した場合には
RuntimeError が発生します。
//emlist[例][ruby]{
TracePoint.trace(:line) do |tp|
p tp.raised_exception
end
# => RuntimeError: 'raised_exception' not supported by this event
//}
イベントフックの外側で、発生したイベントに関連する情報......発生します。
//emlist[例][ruby]{
TracePoint.trace(:line) do |tp|
$tp = tp
end
$tp.lineno # => access from outside (RuntimeError)
//}
他のスレッドから参照する事も禁じられています。
@raise ThreadError ブロックを指定しなかった場合に発生します。......記述されたメソッド呼び出しからのリターン。
: :raise
例外の発生。
: :b_call
ブロックの開始。
: :b_return
ブロックの終了。
: :thread_begin
スレッドの開始。
: :thread_end
スレッドの終了。
: :fiber_switch
ファイバー......生します。
//emlist[例][ruby]{
TracePoint.trace(:line) do |tp|
$tp = tp
end
$tp.lineno # => access from outside (RuntimeError)
//}
他のスレッドから参照する事も禁じられています。
@raise ArgumentError ブロックを指定しなかった場合に発生します。... -
IO
# eof -> bool (18.0) -
ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。
...がデータを送るか close するまでブロックします。
r, w = IO.pipe
Thread.new { sleep 10; w.close }
r.eof? #=> 10秒ブロックしてから true を返す。
r, w = IO.pipe
Thread.new { sleep 10; w.puts "a" }
r.eof? #=> 10秒ブロックしてから false を......r, w = IO.pipe
r.eof? # 永久にブロックします。
eof, eof? は入力バッファにデータを読み込むので、IO#sysread と同時に使うと正常に
動作しません。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。... -
IO
# eof? -> bool (18.0) -
ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。
...がデータを送るか close するまでブロックします。
r, w = IO.pipe
Thread.new { sleep 10; w.close }
r.eof? #=> 10秒ブロックしてから true を返す。
r, w = IO.pipe
Thread.new { sleep 10; w.puts "a" }
r.eof? #=> 10秒ブロックしてから false を......r, w = IO.pipe
r.eof? # 永久にブロックします。
eof, eof? は入力バッファにデータを読み込むので、IO#sysread と同時に使うと正常に
動作しません。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。... -
Process
. # clock _ gettime(clock _ id , unit=:float _ second) -> Float | Integer (18.0) -
POSIX の clock_gettime() 関数の時間を返します。
...3.0, NetBSD 2.0, OpenBSD 3.4, macOS 10.12
: Process::CLOCK_PROCESS_CPUTIME_ID
SUSv3 to 4, Linux 2.5.63, OpenBSD 5.4, macOS 10.12
: Process::CLOCK_THREAD_CPUTIME_ID
SUSv3 to 4, Linux 2.5.63, FreeBSD 7.1, OpenBSD 5.4, macOS 10.12
: Process::CLOCK_VIRTUAL
FreeBSD 3.0, OpenBSD 2.1
: Process::CLOCK_PR......されている clock_gettime を含みます。
SUS では CLOCK_REALTIME は必須ですが、CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID,
CLOCK_THREAD_CPUTIME_ID は任意です。
さらに clock_id はいくつかのシンボルを受け付けます。
それらは clock_gettime() をエミュ......カウントするかどうかが異なります。
そのため、結果はシステムによって解釈が異なります。
CLOCK_REALTIME よりも Time.now をおすすめします。
@raise Errno::EINVAL clock_id がサポートされていない場合に発生します。
@see Time.now... -
rinda
/ rinda (18.0) -
Rubyで実装されたタプルスペース(Tuple Space)を扱うためのライブラリです。
...t
DRb.start_service(uri, Rinda::TupleSpace.new)
puts DRb.uri
DRb.thread.join
# rindas.rb
require 'drb/drb'
require 'rinda/rinda'
def do_it(v)
puts "do_it(#{v})"
v + v
end
uri = ARGV.shift || raise("usage: #{$0} <server_uri>")
DRb.start_service
ts = Rinda::Tup......v = do_it(r[2])
ts.write(['ans', r[1], r[2], v])
end
# rindac.rb
require 'drb/drb'
require 'rinda/rinda'
uri = ARGV.shift || raise("usage: #{$0} <server_uri>")
DRb.start_service
ts = Rinda::TupleSpaceProxy.new(DRbObject.new(nil, uri))
(1..10).each do |n|
ts.wri... -
Fiber
# resume(*arg = nil) -> object (12.0) -
自身が表すファイバーへコンテキストを切り替えます。 自身は resume を呼んだファイバーの子となります。
...の終了まで実行した場合はブロックの評価結果
を返します。
@raise FiberError 自身が既に終了している場合、コンテキストの切替が
Thread クラスが表すスレッド間をまたがる場合、自身が resume を...