コード例 #1
0
 /// <summary>
 ///		Sets the current context for this thread.
 /// </summary>
 /// <param name="context">The context.</param>
 internal static void SetCurrent(RpcApplicationContext context)
 {
     _current             = context;
     context._boundThread = new WeakReference(Thread.CurrentThread);
     context._hardTimeoutWatcher.Reset();
     context._softTimeoutWatcher.Reset();
 }
コード例 #2
0
        /// <summary>
        ///		Clears current instance.
        /// </summary>
        internal static void Clear()
        {
            var current = _current;

            if (current != null)
            {
                try {
                    current.StopTimeoutWatch();
                }
                finally {
                    current._boundThread = null;
                    Interlocked.Exchange(ref current._state, StateActive);
                    _current = null;
                }
            }
        }