DoGet() private method

Get the value of a ref most recently set in this transaction (or prior to entering).
private DoGet ( Ref r ) : object
r Ref
return object
Exemplo n.º 1
0
        /// <summary>
        /// Gets the (immutable) value the reference is holding.
        /// </summary>
        /// <returns>The value</returns>
        public override object deref()
        {
            LockingTransaction t = LockingTransaction.GetRunning();

            if (t == null)
            {
                object ret = currentVal();
                //Console.WriteLine("Thr {0}, {1}: No-trans get => {2}", Thread.CurrentThread.ManagedThreadId,DebugStr(), ret);
                return(ret);
            }
            return(t.DoGet(this));
        }
Exemplo n.º 2
0
        public object alter(IFn fn, ISeq args)
        {
            LockingTransaction t = LockingTransaction.GetEx();

            return(t.DoSet(this, fn.applyTo(RT.cons(t.DoGet(this), args))));
        }