public static InternalThreadLocalMap Get()
 {
     InternalThreadLocalMap ret = slowThreadLocalMap;
     if (ret == null)
     {
         ret = new InternalThreadLocalMap();
         slowThreadLocalMap = ret;
     }
     return ret;
 }
示例#2
0
        protected static void RemoveFromVariablesToRemove(InternalThreadLocalMap threadLocalMap, FastThreadLocal variable)
        {
            object v = threadLocalMap.GetIndexedVariable(VariablesToRemoveIndex);

            if (v == InternalThreadLocalMap.Unset || v == null)
            {
                return;
            }

            var variablesToRemove = (HashSet<FastThreadLocal>)v;
            variablesToRemove.Remove(variable);
        }
示例#3
0
        protected static void AddToVariablesToRemove(InternalThreadLocalMap threadLocalMap, FastThreadLocal variable)
        {
            object v = threadLocalMap.GetIndexedVariable(VariablesToRemoveIndex);
            HashSet<FastThreadLocal> variablesToRemove;
            if (v == InternalThreadLocalMap.Unset || v == null)
            {
                variablesToRemove = new HashSet<FastThreadLocal>(); // Collections.newSetFromMap(new IdentityHashMap<FastThreadLocal<?>, Boolean>());
                threadLocalMap.SetIndexedVariable(VariablesToRemoveIndex, variablesToRemove);
            }
            else
            {
                variablesToRemove = (HashSet<FastThreadLocal>)v;
            }

            variablesToRemove.Add(variable);
        }
示例#4
0
 /// <summary>
 ///     Sets the value to uninitialized; a proceeding call to get() will trigger a call to GetInitialValue().
 /// </summary>
 /// <param name="threadLocalMap"></param>
 public abstract void Remove(InternalThreadLocalMap threadLocalMap);
示例#5
0
 public static void Destroy() => s_slowThreadLocalMap = null;
示例#6
0
 public static void Remove() => s_slowThreadLocalMap = null;
示例#7
0
 /// <summary>
 ///     Sets the value to uninitialized; a proceeding call to get() will trigger a call to GetInitialValue().
 /// </summary>
 /// <param name="threadLocalMap"></param>
 public abstract void Remove(InternalThreadLocalMap threadLocalMap);
示例#8
0
 /// <summary>
 /// Destroys the data structure that keeps all <see cref="FastThreadLocal"/> variables accessed from
 /// non-<see cref="FastThreadLocal"/>s.  This operation is useful when you are in a container environment, and
 /// you do not want to leave the thread local variables in the threads you do not manage.  Call this method when
 /// your application is being unloaded from the container.
 /// </summary>
 public static void Destroy() => InternalThreadLocalMap.Destroy();
 public static void Destroy() => slowThreadLocalMap = null;
 public static void Remove() => slowThreadLocalMap = null;