59件ヒット
[1-59件を表示]
(0.012秒)
種類
- モジュール関数 (33)
- 特異メソッド (12)
- インスタンスメソッド (8)
- 文書 (5)
- 関数 (1)
クラス
- IO (12)
キーワード
-
NEWS for Ruby 3
. 0 . 0 (5) -
rb
_ thread _ select (1) - select (24)
検索結果
先頭5件
- Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object - Timeout
. # timeout(sec , exception _ class , message) {|i| . . . } -> object - Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object - Kernel
# timeout(sec , exception _ class = nil) {|i| . . . . } -> object - IO
. select(reads , writes = [] , excepts = [] , timeout = nil) -> [[IO]] | nil
-
Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object (35368.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...c 秒の期限付きで実行します。
ブロックの実行時間が制限を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはい......す.
@param exception_class タイムアウトした時、発生させる例外を指定します.
@param message エラーメッセージを指定します.省略した場合は
"execution expired" になります.
例 長い計算のタイムアウト
require 'timeout'
def cal......rand
x**2 + y**2 < 1.0 ? min[0] += 1 : min[1] += 1
end
end
t = 5
min = [ 0, 0]
begin
Timeout.timeout(t){
calc_pi(min)
}
rescue Timeout::Error
puts "timeout"
end
printf "%d: pi = %f\n", min[0] + min[1], min[0]*4.0/(min[0]+min[1])
#例
#=> 417519: pi =... -
Timeout
. # timeout(sec , exception _ class , message) {|i| . . . } -> object (35368.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...c 秒の期限付きで実行します。
ブロックの実行時間が制限を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはい......す.
@param exception_class タイムアウトした時、発生させる例外を指定します.
@param message エラーメッセージを指定します.省略した場合は
"execution expired" になります.
例 長い計算のタイムアウト
require 'timeout'
def cal......rand
x**2 + y**2 < 1.0 ? min[0] += 1 : min[1] += 1
end
end
t = 5
min = [ 0, 0]
begin
Timeout.timeout(t){
calc_pi(min)
}
rescue Timeout::Error
puts "timeout"
end
printf "%d: pi = %f\n", min[0] + min[1], min[0]*4.0/(min[0]+min[1])
#例
#=> 417519: pi =... -
Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object (35367.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...c 秒の期限付きで実行します。
ブロックの実行時間が制限を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはい......@param sec タイムアウトする時間を秒数で指定します.
@param exception_class タイムアウトした時、発生させる例外を指定します.
例 長い計算のタイムアウト
require 'timeout'
def calc_pi(min)
loop do
x = rand
y = rand
x**2 +......y**2 < 1.0 ? min[0] += 1 : min[1] += 1
end
end
t = 5
min = [ 0, 0]
begin
Timeout.timeout(t){
calc_pi(min)
}
rescue Timeout::Error
puts "timeout"
end
printf "%d: pi = %f\n", min[0] + min[1], min[0]*4.0/(min[0]+min[1])
#例
#=> 417519: pi = 3.141443
例 独... -
Kernel
# timeout(sec , exception _ class = nil) {|i| . . . . } -> object (26236.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...c 秒の期限付きで実行します。
ブロックの実行時間が制限を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはい.......
@param exception_class タイムアウトした時、発生させる例外を指定します.
=== 注意
timeout による割り込みは Thread によって実現されています。C 言語
レベルで実装され、Ruby のスレッドが割り込めない処理に対して
timeout は無... -
IO
. select(reads , writes = [] , excepts = [] , timeout = nil) -> [[IO]] | nil (207.0) -
select(2) を実行します。
...します。
@param writes 出力待ちする IO オブジェクトの配列を渡します。
@param excepts 例外待ちする IO オブジェクトの配列を渡します。
@param timeout タイムアウトまでの時間を表す数値または nil を指定します。数値で指定した... -
Kernel
. # select(reads , writes = [] , excepts = [] , timeout = nil) -> [[IO]] | nil (207.0) -
IO.select と同じです。
...IO.select と同じです。
@param reads IO.select 参照
@param writes IO.select 参照
@param excepts IO.select 参照
@param timeout IO.select 参照
@see IO.select... -
int rb
_ thread _ select(int max , fd _ set *read , fd _ set *write , fd _ set *except , struct timeval *timeout) (200.0) -
この関数は deprecated です。rb_thread_fd_select を使用してください。
この関数は deprecated です。rb_thread_fd_select を使用してください。
Ruby のスレッドは実装のために内部で select(2) を使っているため、
拡張ライブラリ内で独自に select(2) を使った場合の動作は保証されません。
代わりにこの関数 rb_thread_select を使ってください。
引数の意味は select(2) と同じです。 -
NEWS for Ruby 3
. 0 . 0 (24.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...g context. 16786
* Dir
* Dir.glob and Dir.[] now sort the results by default, and accept the `sort:` keyword option. 8709
* ENV
* ENV.except has been added, which returns a hash excluding the given keys and their values. 15822
* Windows: Read ENV names and values as UTF-8 encoded S......ase test first! 17176
* Hash
* Hash#transform_keys and Hash#transform_keys! now accept a hash that maps keys to new keys. 16274
* Hash#except has been added, which returns a hash excluding the given keys and their values. 15822
* IO
* IO#nonblock? now defaults to `true`. 16786......eadable, IO#wait_writable, IO#read, IO#write and other related methods (e.g. IO#puts, IO#gets) may invoke the scheduler hook `#io_wait(io, events, timeout)` in a non-blocking execution context. 16786
* Kernel
* Kernel#clone when called with the `freeze: false` keyword will call `#initialize_cl...