るりまサーチ

最速Rubyリファレンスマニュアル検索!
60件ヒット [1-60件を表示] (0.074秒)

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dsa p
  5. rsa p

クラス

キーワード

検索結果

Thread.pass -> nil (24227.0)

他のスレッドに実行権を譲ります。実行中のスレッドの状態を変えずに、 他の実行可能状態のスレッドに制御を移します。

...権を譲ります。実行中のスレッドの状態を変えずに、
他の実行可能状態のスレッドに制御を移します。

Thread.new do
(1..3).each{|i|
p
i
Thread.pass
}
exit
end

loop do
Thread.pass
p
:main
end

#=>
1
:main
2
:main
3
:main...

Thread.handle_interrupt(hash) { ... } -> object (6108.0)

スレッドの割り込みのタイミングを引数で指定した内容に変更してブロックを 実行します。

...、非同期イベントや Thread#raise や
Thread#kill、Signal.#trap(未サポート)、メインスレッドの終了
(メインスレッドが終了すると、他のスレッドも終了されます)を意味します。

@param hash 例外クラスがキー、割り込みのタイミングを...
...に含まれます。

また、マスクされた非同期割り込みは再度有効にされるまで延期されます。本
メソッドは sigprocmask(3) に似ています。

@return ブロックの評価結果を返します。

@raise ArgumentError ブロックを指定しなかった場...
...e_interrupt(RuntimeError => :never) {
begin
# 安全にリソースの割り当てが可能
Thread.handle_interrupt(RuntimeError => :immediate) {
# ...
}
ensure
# 安全にリソースの解放が可能
end
}
end
Thread.pass
# ......

Thread.pending_interrupt?(error = nil) -> bool (6108.0)

非同期割り込みのキューが空かどうかを返します。

...ad.handle_interrupt は非同期割り込みの発生を延期させるのに使
用しますが、本メソッドは任意の非同期割り込みが存在するかどうかを確認す
るのに使用します。

本メソッドが true を返した場合、Thread.handle_interrupt で例外の...
...

@param error 対象の例外クラスを指定します。省略した場合は全ての例外を対
象に確認を行います。

例: 延期させられていた例外をただちに発生させる。

def Thread.kick_interrupt_immediately
Thread.handle_interrupt(Object =...
...ad.pass
}
end

=== 使い方

th = Thread.new{
Thread.handle_interrupt(RuntimeError => :on_blocking){
while true
...
# ここまでで割り込みが発生しても安全な状態になった。
if Thread.pending_interrupt?
Thread.handle_interrupt(...

Proc#ruby2_keywords -> proc (3108.0)

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.

...e proc as passing keywords through a normal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked with a sp...
...f a normal argument splat to another method call, and that
method call does not include explicit keywords or a keyword splat, the
final element is interpreted as keywords. In other words, keywords will
be passed through the proc to other methods.

This should only be used for procs that delegate ke...
...another
method, and only for backwards compatibility with Ruby versions before
2.7.

This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the proc responds to this method before calling
it. Als...

Object#initialize(*args, &block) -> object (32.0)

ユーザ定義クラスのオブジェクト初期化メソッド。

...う名前のメソッドは自動的に private に設定され
ます。

@param args 初期化時の引数です。
@param block 初期化時のブロック引数です。必須ではありません。

//emlist[][ruby]{
class Foo
def initialize name
p
uts "initialize Foo"
@name = name...
...end
end

class Bar < Foo
def initialize name, pass
p
uts "initialize Bar"
super name
@pass = pass
end
end

it = Bar.new('myname','0500')
p
it
#=> initialize Bar
# initialize Foo
# #<Bar:0x2b68f08 @name="myname", @pass="0500">
//}

@see Class#new...

絞り込み条件を変える

Thread (20.0)

スレッドを表すクラスです。スレッドとはメモリ空間を共有して同時に実行される制御の流れです。 Thread を使うことで並行プログラミングが可能になります。

...スレッドの実行も終
了します。ブロックの終了は正常な終了も例外などによる異常終了も含みます。

===[a:exception] 例外発生時のスレッドの振る舞い

あるスレッドで例外が発生し、そのスレッド内で rescue で捕捉されなかっ...
...再度
発生します。

begin
t = Thread.new do
Thread.pass # メインスレッドが確実にjoinするように
raise "unhandled exception"
end
t.join
rescue
p
$! # => "unhandled exception"
end

また、以下の 3 つの方法により、いずれかの...
...ション 付きで起動した場合も同様。
(オプションの詳細に関してはspec/rubycmd を参照)
* Thread.abort_on_exception でフラグを設定する。
* Thread#abort_on_exception で指定
したスレッドのフラグを設定する。

上記3つのいずれか...