本文簡要介紹ruby語言中 Thread::Queue.new
的用法。
用法
Thread::Queue.new → empty_queue
Thread::Queue.new(enumerable) → queue
創建一個新的隊列實例,可選擇使用 enumerable
的內容作為其初始狀態。
例子:
q = Thread::Queue.new
#=> #<Thread::Queue:0x00007ff7501110d0>
q.empty?
#=> true
q = Thread::Queue.new([1, 2, 3])
#=> #<Thread::Queue:0x00007ff7500ec500>
q.empty?
#=> false
q.pop
#=> 1
相關用法
- Ruby Queue.close用法及代碼示例
- Ruby Queue closed?用法及代碼示例
- Ruby Queue close()用法及代碼示例
- Ruby Queue deq()用法及代碼示例
- Ruby Queue enq()用法及代碼示例
- Ruby Queue clear()用法及代碼示例
- Ruby Queue new()用法及代碼示例
- Ruby Queue size()用法及代碼示例
- Ruby Queue empty?用法及代碼示例
- Ruby Queue pop()用法及代碼示例
- Ruby Queue shift()用法及代碼示例
- Ruby Queue length()用法及代碼示例
- Ruby Queue類用法及代碼示例
- Ruby Queue push()用法及代碼示例
- Ruby QueryExtension.read_multipart用法及代碼示例
- Ruby Time tv_sec用法及代碼示例
- Ruby MatchData.pre_match用法及代碼示例
- Ruby Symbol capitalize用法及代碼示例
- Ruby Matrix lup()用法及代碼示例
- Ruby SizedQueue clear()用法及代碼示例
- Ruby Object.instance_variable_get用法及代碼示例
- Ruby Spotter.spot_op_asgn2_for_name用法及代碼示例
- Ruby Float arg()用法及代碼示例
- Ruby WIN32OLE_METHOD#visible?用法及代碼示例
- Ruby Matrix unitary?()用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Queue.new。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。