コード例 #1
0
ファイル: RunspacePoolInternal.cs プロジェクト: nickchal/pash
 protected RunspacePoolInternal(int minRunspaces, int maxRunspaces)
 {
     this.runspaceList = new List<Runspace>();
     this.syncObject = new object();
     this.apartmentState = System.Threading.ApartmentState.Unknown;
     if (maxRunspaces < 1)
     {
         throw PSTraceSource.NewArgumentException("maxRunspaces", resBaseName, "MaxPoolLessThan1", new object[0]);
     }
     if (minRunspaces < 1)
     {
         throw PSTraceSource.NewArgumentException("minRunspaces", resBaseName, "MinPoolLessThan1", new object[0]);
     }
     if (minRunspaces > maxRunspaces)
     {
         throw PSTraceSource.NewArgumentException("minRunspaces", resBaseName, "MinPoolGreaterThanMaxPool", new object[0]);
     }
     this.maxPoolSz = maxRunspaces;
     this.minPoolSz = minRunspaces;
     this.stateInfo = new System.Management.Automation.RunspacePoolStateInfo(RunspacePoolState.BeforeOpen, null);
     this.instanceId = Guid.NewGuid();
     PSEtwLog.SetActivityIdForCurrentThread(this.instanceId);
     this.cleanupInterval = DefaultCleanupPeriod;
     this.cleanupTimer = new Timer(new TimerCallback(this.CleanupCallback), null, -1, -1);
 }
コード例 #2
0
 protected RunspacePoolInternal(int minRunspaces, int maxRunspaces)
 {
     this.runspaceList   = new List <Runspace>();
     this.syncObject     = new object();
     this.apartmentState = System.Threading.ApartmentState.Unknown;
     if (maxRunspaces < 1)
     {
         throw PSTraceSource.NewArgumentException("maxRunspaces", resBaseName, "MaxPoolLessThan1", new object[0]);
     }
     if (minRunspaces < 1)
     {
         throw PSTraceSource.NewArgumentException("minRunspaces", resBaseName, "MinPoolLessThan1", new object[0]);
     }
     if (minRunspaces > maxRunspaces)
     {
         throw PSTraceSource.NewArgumentException("minRunspaces", resBaseName, "MinPoolGreaterThanMaxPool", new object[0]);
     }
     this.maxPoolSz  = maxRunspaces;
     this.minPoolSz  = minRunspaces;
     this.stateInfo  = new System.Management.Automation.RunspacePoolStateInfo(RunspacePoolState.BeforeOpen, null);
     this.instanceId = Guid.NewGuid();
     PSEtwLog.SetActivityIdForCurrentThread(this.instanceId);
     this.cleanupInterval = DefaultCleanupPeriod;
     this.cleanupTimer    = new Timer(new TimerCallback(this.CleanupCallback), null, -1, -1);
 }
コード例 #3
0
 public RunspacePoolInternal(int minRunspaces, int maxRunspaces, System.Management.Automation.Runspaces.InitialSessionState initialSessionState, PSHost host) : this(minRunspaces, maxRunspaces)
 {
     if (initialSessionState == null)
     {
         throw PSTraceSource.NewArgumentNullException("initialSessionState");
     }
     if (host == null)
     {
         throw PSTraceSource.NewArgumentNullException("host");
     }
     this._initialSessionState = initialSessionState.Clone();
     this.apartmentState       = initialSessionState.ApartmentState;
     this.threadOptions        = initialSessionState.ThreadOptions;
     this.host = host;
     this.pool = new Stack <Runspace>();
     this.runspaceRequestQueue = new Queue <GetRunspaceAsyncResult>();
     this.ultimateRequestQueue = new Queue <GetRunspaceAsyncResult>();
 }
コード例 #4
0
ファイル: RunspacePoolInternal.cs プロジェクト: nickchal/pash
 public RunspacePoolInternal(int minRunspaces, int maxRunspaces, System.Management.Automation.Runspaces.InitialSessionState initialSessionState, PSHost host) : this(minRunspaces, maxRunspaces)
 {
     if (initialSessionState == null)
     {
         throw PSTraceSource.NewArgumentNullException("initialSessionState");
     }
     if (host == null)
     {
         throw PSTraceSource.NewArgumentNullException("host");
     }
     this._initialSessionState = initialSessionState.Clone();
     this.apartmentState = initialSessionState.ApartmentState;
     this.threadOptions = initialSessionState.ThreadOptions;
     this.host = host;
     this.pool = new Stack<Runspace>();
     this.runspaceRequestQueue = new Queue<GetRunspaceAsyncResult>();
     this.ultimateRequestQueue = new Queue<GetRunspaceAsyncResult>();
 }
コード例 #5
0
ファイル: RunspacePoolInternal.cs プロジェクト: nickchal/pash
 internal RunspacePoolInternal()
 {
     this.runspaceList = new List<Runspace>();
     this.syncObject = new object();
     this.apartmentState = System.Threading.ApartmentState.Unknown;
 }
コード例 #6
0
ファイル: AsyncTask.cs プロジェクト: liamkou/utilities
 public void SetApartment(System.Threading.ApartmentState state)
 {
     mApartment = state;
 }
コード例 #7
0
 public void TrySetApartmentState(System.Threading.ApartmentState state)
 {
     threadField.TrySetApartmentState(state);
 }
コード例 #8
0
 internal RunspacePoolInternal()
 {
     this.runspaceList   = new List <Runspace>();
     this.syncObject     = new object();
     this.apartmentState = System.Threading.ApartmentState.Unknown;
 }
コード例 #9
0
 private void InitializeInternal()
 {
     System.Threading.ApartmentState state =
         System.Threading.Thread.CurrentThread.GetApartmentState();
     LogInfo(LogGroups.Console, state.ToString() + "\n");
 }