public void checkStateAndGetTree(out RbTree tree, out error err)
        {
            tree = null;
            err  = null;
            lock (this.mtx)
            {
                switch ((IterationState)this.state)
                {
                case IterationState.iteratorWalking:
                    err = ErrorDef.ErrIteratorAlreadyRunning;
                    return;

                case IterationState.iteratorClosed:
                    err = ErrorDef.ErrIteratorClosed;
                    return;

                case IterationState.iteratorUninitialized:
                    err = ErrorDef.ErrIteratorUninitialized;
                    return;

                case IterationState.iteratorReady:
                    this.count = 0;
                    this.state = (long)IterationState.iteratorWalking;
                    break;
                }
                if (this.tree == null)
                {
                    err = ErrorDef.ErrIteratorClosed;
                    return;
                }
            }
            tree = this.tree;
        }
 public void Close()
 {
     lock (this.mtx)
     {
         this.state    = (long)IterationState.iteratorClosed;
         this.callback = nilIterationCallback;
         this.tree     = null;
     }
 }