Example #1
0
        internal static ActiveTxnRecord GetOldestRecord(TxnContext upTo)
        {
            var             context      = TxnContext.Head;
            ActiveTxnRecord oldestRecord = null;
            TxnContext      prevContext  = null;

            while (context != upTo)
            {
                var contextOldest = context.OldestRequiredRecord;
                if (oldestRecord == null || (contextOldest != null && oldestRecord.TxNumber > contextOldest.TxNumber))
                {
                    oldestRecord = contextOldest;
                }

                if (!context.OwningThread.IsAlive && prevContext != null)
                {
                    prevContext.Next = context.Next;
                }

                prevContext = context;
                context     = context.Next;
            }

            return(oldestRecord);
        }
Example #2
0
 private TxnContext(Thread thread, TxnContext next)
 {
     OwningThread = thread;
     Next         = next;
 }