Copy() 개인적인 정적인 메소드

Copies the values from the specified scope object to the ConnectionScope used by the current thread.
private static Copy ( ConnectionScope scope ) : void
scope ConnectionScope A object.
리턴 void
예제 #1
0
        /// <summary>
        /// Queues a method for execution. The method executes
        /// when a thread pool thread becomes available.
        /// </summary>
        /// <param name="start">A delegate specifying which method to run
        /// when the <see cref="Thread"/> is started.</param>
        /// <returns>Returns true if the method is successfully queued.</returns>
        public static bool EnqueueOnThreadPool(ThreadStart start)
        {
            ConnectionScope scope = ConnectionScope.Current;

            return(ThreadPool.QueueUserWorkItem(delegate(object state)
            {
                ConnectionScope.Copy(scope);
                start();
            }, null));
        }
예제 #2
0
        /// <summary>
        /// Queues a method for execution. The method executes
        /// when a thread pool thread becomes available.
        /// </summary>
        /// <param name="start">A delegate specifying which method to run
        /// when the <see cref="Thread"/> is started.</param>
        /// <param name="state">An object containing data to be used by the method.</param>
        /// <returns>Returns true if the method is successfully queued.</returns>
        public static bool EnqueueOnThreadPool(ParameterizedThreadStart start, object state)
        {
            ConnectionScope scope = ConnectionScope.Current;

            return(ThreadPool.QueueUserWorkItem(delegate(object originalState)
            {
                ConnectionScope.Copy(scope);
                start(originalState);
            }, state));
        }
예제 #3
0
        /// <summary>
        /// Creates a new <see cref="Thread"/> object and copies
        /// the current <see cref="ConnectionScope"/> parameters.
        /// </summary>
        /// <param name="start">A delegate specifying which method to run
        /// when the <see cref="Thread"/> is started.</param>
        /// <returns>Returns a new <see cref="Thread"/> object.</returns>
        public static Thread NewThread(ThreadStart start)
        {
            ConnectionScope scope = ConnectionScope.Current;

            Thread t = new Thread(delegate()
            {
                ConnectionScope.Copy(scope);
                start();
            });

            return(t);
        }
예제 #4
0
        /// <summary>
        /// Creates a new <see cref="Thread"/> object and copies
        /// the current <see cref="ConnectionScope"/> parameters.
        /// </summary>
        /// <param name="start">A delegate specifying which method to run
        /// when the <see cref="Thread"/> is started.</param>
        /// <returns>Returns a new <see cref="Thread"/> object.</returns>
        public static Thread NewThread(ParameterizedThreadStart start)
        {
            ConnectionScope scope = ConnectionScope.Current;

            Thread t = new Thread(delegate(Object obj)
            {
                ConnectionScope.Copy(scope);
                start(obj);
            });

            return(t);
        }