/// <summary> /// Allocate a new Entry to track a thread's protected/unprotected status and /// return the index to it. This should only be called once for a thread. /// </summary> /// <returns></returns> private int ReserveEntryForThread() { int threadId = (int)Native32.GetCurrentThreadId(); int startIndex = Utility.Murmur3(threadId); return(ReserveEntry(startIndex, threadId)); }
/// <summary> /// Allocate a new entry in epoch table. This is called /// once for a thread. /// </summary> /// <returns>Reserved entry</returns> private int ReserveEntryForThread() { // for portability(run on non-windows platform) int threadId = Environment.OSVersion.Platform == PlatformID.Win32NT ? (int)Native32.GetCurrentThreadId() : Thread.CurrentThread.ManagedThreadId; int startIndex = Utility.Murmur3(threadId); return(ReserveEntry(startIndex, threadId)); }
/// <summary> /// Allocate a new entry in epoch table. This is called /// once for a thread. /// </summary> /// <returns>Reserved entry</returns> private static int ReserveEntryForThread() { if (threadId == 0) // run once per thread for performance { // For portability (run on non-windows platform) threadId = Environment.OSVersion.Platform == PlatformID.Win32NT ? (int)Native32.GetCurrentThreadId() : Thread.CurrentThread.ManagedThreadId; threadIdHash = Utility.Murmur3(threadId); } return(ReserveEntry(threadIdHash, threadId)); }
/// <summary> /// Allocate a new entry in epoch table. This is called /// once for a thread. /// </summary> /// <returns>Reserved entry</returns> static int ReserveEntryForThread() { if (threadId == 0) // run once per thread for performance { threadId = Environment.CurrentManagedThreadId; uint code = (uint)Utility.Murmur3(threadId); startOffset1 = (ushort)(1 + (code % kTableSize)); startOffset2 = (ushort)(1 + ((code >> 16) % kTableSize)); } return(ReserveEntry()); }