示例#1
0
 private void InitializeThreadState(object threadParams, ThreadWorkerMethodWithReturnAndParam workerMethod, ApartmentState aptState, bool background)
 {
     this.threadParams = threadParams;
     this.threadWorkerMethodWithReturnAndParam = workerMethod;
     this.thread = new Thread(new ThreadStart(this.ThreadEntryPointMethodWithReturnAndParam));
     this.thread.SetApartmentState(aptState);
     this.backgroundThread = background;
 }
 private ThreadDispatch()
 {
     this.thread = null;
     this.exception = null;
     this.threadParams = null;
     this.threadWorkerMethodWithReturn = null;
     this.threadWorkerMethodWithReturnAndParam = null;
     this.threadWorkerMethod = null;
     this.threadWorkerMethodWithParam = null;
     this.threadReturn = null;
     this.backgroundThread = false;
     this.apartmentType = ApartmentState.MTA;
 }
示例#3
0
 private ThreadDispatch()
 {
     this.thread       = null;
     this.exception    = null;
     this.threadParams = null;
     this.threadWorkerMethodWithReturn         = null;
     this.threadWorkerMethodWithReturnAndParam = null;
     this.threadWorkerMethod          = null;
     this.threadWorkerMethodWithParam = null;
     this.threadReturn     = null;
     this.backgroundThread = false;
     this.apartmentType    = ApartmentState.MTA;
 }
 /// <summary>
 /// Initializes the thread state members.
 /// </summary>
 /// <param name="threadParams">Parameters to be passed to thread</param>
 /// <param name="workerMethod">The delegate to be called from thread</param>
 /// <param name="aptState">The apartment of the thread created</param>
 private void InitializeThreadState ( object threadParams, ThreadWorkerMethodWithReturnAndParam workerMethod, ApartmentState aptState, bool background )
 {
     this.threadParams = threadParams ;
     this.threadWorkerMethodWithReturnAndParam = workerMethod ;
     this.thread = new Thread ( new ThreadStart ( ThreadEntryPointMethodWithReturnAndParam ) ) ;
     this.thread.SetApartmentState(aptState);
     this.backgroundThread = background ;
 }
 /// <summary>
 /// Constructs a ThreadDispatch object with the thread worker method.
 /// Default settings on the ThreadDispatch object are:
 ///     1. Parameter is null
 ///     2. Thread ApartmentState will be MTA
 ///     3. Background thread status will be false
 /// </summary>
 /// <param name="workerMethod">Delegate to be called to perform the work</param>
 public ThreadDispatch ( ThreadWorkerMethodWithReturnAndParam workerMethod ) : this ( )
 {
     InitializeThreadState ( null, workerMethod, ApartmentState.MTA, false ) ;
 }
示例#6
0
 public ThreadDispatch(ThreadWorkerMethodWithReturnAndParam workerMethod) : this()
 {
     this.InitializeThreadState(null, workerMethod, ApartmentState.MTA, false);
 }