種類
- インスタンスメソッド (44)
- 文書 (26)
- 関数 (22)
- モジュール (11)
クラス
- Thread (11)
-
Thread
:: Queue (33)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - << (11)
- Marshal フォーマット (11)
- MonitorMixin (11)
-
NEWS for Ruby 3
. 0 . 0 (4) - enq (11)
-
rb
_ ary _ push (11) -
rb
_ dvar _ push (11)
検索結果
先頭5件
-
Thread
# value -> object (18131.0) -
スレッド self が終了するまで待ち(Thread#join と同じ)、 そのスレッドのブロックが返した値を返します。スレッド実行中に例外が 発生した場合には、その例外を再発生させます。
...を出力する例です。
threads = []
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.each {|t| p t.value}
最後の行で、待ち合わせを行っている......ことがわかりにくいと思うなら以下
のように書くこともできます。
threads.each {|t| p t.join.value}... -
Thread
:: Queue # push(value) -> () (15204.0) -
キューの値を追加します。待っているスレッドがいれば実行を再開 させます。返り値は不定です。
キューの値を追加します。待っているスレッドがいれば実行を再開
させます。返り値は不定です。 -
VALUE rb
_ ary _ push(VALUE ary , VALUE item) (6418.0) -
配列 ary の末尾に item を追加します。
...配列 ary の末尾に item を追加します。
対応するRubyコード
ary.push(item) または
ary << item
使用例
VALUE ary = rb_ary_new();
char line[4096];
while ((gets(line)) != NULL){
item = process_apache_log(line);
rb_ary_push(ary, item);
}... -
void rb
_ dvar _ push(ID id , VALUE value) (6300.0) -
-
Thread
:: Queue # <<(value) -> () (104.0) -
キューの値を追加します。待っているスレッドがいれば実行を再開 させます。返り値は不定です。
キューの値を追加します。待っているスレッドがいれば実行を再開
させます。返り値は不定です。 -
Thread
:: Queue # enq(value) -> () (104.0) -
キューの値を追加します。待っているスレッドがいれば実行を再開 させます。返り値は不定です。
キューの値を追加します。待っているスレッドがいれば実行を再開
させます。返り値は不定です。 -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (48.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...)) [new]
追加。((<ruby-talk:9460>))が実装に至った経緯だと思う
=== LocalJumpError
: ((<LocalJumpError#exit_value|LocalJumpError/exit_value>)) [new]
: ((<LocalJumpError#reason|LocalJumpError/reason>)) [new]
追加
=== Marshal
: ((<Marshal/Object#marshal_load>)) [new]......他
: ((<Array#values_at|Array/values_at>)) [new]
: ((<Hash#values_at|Hash/values_at>)) [new]
: ((<ENV/ENV.values_at>)) [new]
: ((<MatchData#values_at|MatchData/values_at>)) [new]
: ((<aStruct#values_at|Struct/values_at>)) [new]
ruby 1.6 の ((<indexes|Array/indexes>)) は、values_at という......。
=== Array
: ((<Array#first|Array/first>)) [compat]
: ((<Array#last|Array/last>)) [compat]
省略可能な引数を追加
: ((<Array#push|Array/push>)) [compat]
: ((<Array#unshift|Array/unshift>)) [compat]
: ((<Array#insert|Array/insert>)) [compat]
引数が指定されない場合に、... -
NEWS for Ruby 3
. 0 . 0 (30.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...* Interpolated String literals are no longer frozen when
`# frozen-string-literal: true` is used. 17104
* Magic comment `shareable_constant_value` added to freeze constants.
See {Magic Comments}[rdoc-ref:doc/syntax/comments.rdoc@Magic+Comments] for more details.
17273
* A {static a......When the environment variable `RUBY_PAGER` or `PAGER` is present and has
a non-empty value, and the standard input and output are tty, the `--help`
option shows the help message via the pager designated by the value.
16754
=== `--backtrace-limit` option
The `--backtrace-limit` option limits the m......ill return true for separate Proc instances if the procs were created from the same block. 14267
* Queue / SizedQueue
* Queue#pop, SizedQueue#push and related methods may now invoke the `block`/`unblock` scheduler hooks in a non-blocking context. 16786
* Ractor
* New class added to enabl... -
Marshal フォーマット (18.0)
-
Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。
.../emlist[例][ruby]{
p Marshal.dump([true, false, nil]).unpack("x2 a c a a a")
# => ["[", 8, "T", "F", "0"]
//}
=== Hash
==== Hash without default value
'{' で始まるデータ構造になります。
//emlist{
| '{' | 要素数(Fixnum形式) | キーの dump | 値の dump | ... |
//}
//emlist.......dump({true => false, false => true, nil => nil}).unpack("x2 a c aa aa aa")
# => ["{", 8, "T", "F", "F", "T", "0", "0"]
//}
==== Hash with default value (not Proc)
'}' で始まるデータ構造になります。
//emlist{
| '}' | 要素数(Fixnum形式) | キーの dump | 値の dump | ... |......| オブジェクトの実体を指す番号(Fixnum形式) |
//}
//emlist[例][ruby]{
obj = Object.new
p Marshal.dump([obj, obj]).unpack("x2 ac aaca6c aca*")
# => ["[", 7, "o", ":", 11, "Object", 0, "@", 6, ""]
ary = []
ary.push ary
p Marshal.dump(ary).unpack("x2 acac")
# => ["[", 6, "@", 0]
//}... -
MonitorMixin (18.0)
-
スレッドの同期機構としてのモニター機能を提供するモジュールです。
...してこの行を実行
end # ロックを開放
end
end
# producer
while line = ARGF.gets
buf.synchronize do # ロックする
buf.push(line) # 配列を変更(追加)
empty_cond.signal # 配列に要素が追加されたことを条件変数を通して通知
end # ここでロ......必要があります。
//emlist[include する例][ruby]{
require 'monitor'
class MyObject
include MonitorMixin
def initialize(val)
super()
@value = val
end
def to_s
synchronize {
@value.to_s
}
end
end
//}
以下も参考になります。
* 9384
* 9386...