diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-05-30 04:24:17 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-05-30 04:24:17 +0000 |
| commit | ec620c402573af9960920809c6b210fcbc9e9fba (patch) | |
| tree | f08529a845b5a16b93635eeb06b58553252692c9 /lib/thread.rb | |
| parent | 27351b924a7fc0aa47da3e19f01468904c32dbe2 (diff) | |
| download | ruby-ec620c402573af9960920809c6b210fcbc9e9fba.tar.gz ruby-ec620c402573af9960920809c6b210fcbc9e9fba.tar.xz ruby-ec620c402573af9960920809c6b210fcbc9e9fba.zip | |
2000-05-30
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/thread.rb')
| -rw-r--r-- | lib/thread.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/thread.rb b/lib/thread.rb index a0e6967a2..fd51d6d56 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -162,9 +162,11 @@ class Queue end t.run if t end - alias enq push + def enq(obj) + push(obj) + end - def pop non_block=false + def pop(non_block=false) Thread.critical = true begin loop do @@ -182,8 +184,10 @@ class Queue Thread.critical = false end end - alias shift pop - alias deq pop + def shift(non_block=false) + pop(non_block=false) + end + alias deq shift def empty? @que.length == 0 @@ -196,8 +200,9 @@ class Queue def length @que.length end - alias size length - + def size + length + end def num_waiting @waiting.size |
