Permalink
Browse files

Fix empty? method behavior when there is marked node.

  • Loading branch information...
metanest committed Aug 13, 2010
1 parent 541264b commit fdd65b3e0b4d4d7f319b5e606aaed83763b9abd0
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/skiplist.rb
View
@@ -35,7 +35,7 @@
#= Lock-Free Skip List
#
#Authors:: KISHIMOTO, Makoto
-#Version:: 0.0.1 2010-Aug-13
+#Version:: 0.0.2 2010-Aug-13
#Copyright:: Copyright (c) 2010 KISHIMOTO, Makoto
#License:: (other than loop.rb ) X License
#
@@ -44,7 +44,7 @@
#- The Art of Multiprocessor Programming, Chap. 14
#
class SkipList
- VERSION = '0.0.1'
+ VERSION = '0.0.2'
#
# Node of SkipList, inner use only
@@ -145,7 +145,13 @@ def rand2exp ex
# Returns <code>true</code> if <i>lst</i> contains no elements.
#
def empty?
- @head[0].get_link.equal? @tail
+ p = @head[0].get_link
+ pp, m = p[0].get
+ while m do
+ p = pp
+ pp, m = p[0].get
+ end
+ p.equal? @tail
end
#

0 comments on commit fdd65b3

Please sign in to comment.