예제 #1
0
파일: ThreadEx.cs 프로젝트: dadhi/ecsharp
 /// <summary>Constructs a ThreadLocalVariable.</summary>
 /// <param name="initialValue">Initial value on the current thread.
 /// Does not affect other threads that are already running.</param>
 /// <param name="fallbackValue">Value to use when a given thread
 /// doesn't have an associated value.</param>
 /// <param name="propagator">A function that copies (and possibly
 /// modifies) the Value from a parent thread when starting a new
 /// thread.</param>
 public ThreadLocalVariable(T initialValue, T fallbackValue, Func <T, T> propagator)
 {
     _fallbackValue = fallbackValue;
     Value          = initialValue;
     if (propagator != null)
     {
         _propagator = propagator;
     }
     ThreadEx.RegisterTLV(this);
 }
예제 #2
0
파일: ThreadEx.cs 프로젝트: dadhi/ecsharp
 public ThreadLocalVariable()
 {
     ThreadEx.RegisterTLV(this);
 }