Example #1
0
File: Stm.cs Project: gusty/fsharpx
        public void WriteTVar <T>(TVar <T> location, T value)
        {
            Entry entry;

            if (log.TryGetValue(location, out entry))
            {
                ((Entry <T>)entry).newValue = value;
            }
            else
            {
                Entry <T> entryT = new Entry <T>(location, value);
                log.Add(location, entryT);
            }
        }
Example #2
0
File: Stm.cs Project: gusty/fsharpx
        public T ReadTVar <T>(TVar <T> location)
        {
            TLog trans = this;

            do
            {
                Entry entry;
                if (trans.log.TryGetValue(location, out entry))
                {
                    return(((Entry <T>)entry).newValue);
                }
                trans = trans.outer;
            } while(trans != null);

            Entry <T> entryT = new Entry <T>(location);

            log.Add(location, entryT);
            return(entryT.oldValue);
        }