本文簡要介紹ruby語言中 Ractor.close_incoming
的用法。
用法
close_incoming → true | false
關閉傳入端口並返回其先前的狀態。在 ractor 中對 Ractor.receive
和對 ractor 的 send
的所有進一步嘗試都將失敗並顯示 Ractor::ClosedError
。
r = Ractor.new {sleep(500)}
r.close_incoming #=> false
r.close_incoming #=> true
r.send('test')
# Ractor::ClosedError (The incoming-port is already closed)
相關用法
- Ruby Ractor.close_outgoing用法及代碼示例
- Ruby Ractor.count用法及代碼示例
- Ruby Ractor.current用法及代碼示例
- Ruby Ractor.receive_if用法及代碼示例
- Ruby Ractor.shareable?用法及代碼示例
- Ruby Ractor.new用法及代碼示例
- Ruby Ractor.receive用法及代碼示例
- Ruby Ractor.yield用法及代碼示例
- Ruby Ractor.send用法及代碼示例
- Ruby Ractor.take用法及代碼示例
- Ruby Ractor.make_shareable用法及代碼示例
- Ruby Ractor.select用法及代碼示例
- Ruby Ractor類用法及代碼示例
- Ruby Racc模塊用法及代碼示例
- Ruby Range.end用法及代碼示例
- Ruby Range new()用法及代碼示例
- Ruby Rational.inspect用法及代碼示例
- Ruby Random.bytes用法及代碼示例
- Ruby Random hex()用法及代碼示例
- Ruby Range.size用法及代碼示例
- Ruby Rational.rational <=>用法及代碼示例
- Ruby Rational to_i()用法及代碼示例
- Ruby Rational.rat ** numeric用法及代碼示例
- Ruby Random random_number()用法及代碼示例
- Ruby Range last()用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Ractor.close_incoming。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。