예제 #1
0
 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();
예제 #9
0
 public static void Destroy() => slowThreadLocalMap = null;
예제 #10
0
 public static void Remove() => slowThreadLocalMap = null;