本文整理汇总了C#中ProcessState.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessState.ToString方法的具体用法?C# ProcessState.ToString怎么用?C# ProcessState.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProcessState
的用法示例。
在下文中一共展示了ProcessState.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FireStateChange
public void FireStateChange(int processId, ProcessState newState)
{
try
{
vertexScheduler.ProcessChangeState(processId, newState);
}
catch (Exception e)
{
DryadLogger.LogError(0, e, "Failed to change state to {0} for process {1}", newState.ToString(), processId);
}
}
示例2: ChangeState
public void ChangeState(ProcessState newState)
{
lock (SyncRoot)
{
if (newState > m_currentState)
{
DryadLogger.LogDebug("Change State", "Transition process {0} from state {1} to state {2}", m_id, m_currentState, newState);
m_currentState = newState;
List<ProcessState> listenersToRemove = new List<ProcessState>();
List<ProcessState> waitersToRemove = new List<ProcessState>();
// Check for listeners / waiters for earlier states, in case a state is skipped (e.g. process failed to start)
foreach (ProcessState s in m_stateChangeListeners.Keys)
{
if (s <= m_currentState)
{
// Notify listeners
if (m_stateChangeListeners[s] != null)
{
XComputeProcessStateChangeEventArgs e = new XComputeProcessStateChangeEventArgs(m_id, m_currentState, false);
m_stateChangeListeners[s](this, e);
if (m_stateChangeTimers.ContainsKey(m_stateChangeListeners[s]))
{
m_stateChangeTimers[m_stateChangeListeners[s]].Dispose();
m_stateChangeTimers.Remove(m_stateChangeListeners[s]);
}
}
listenersToRemove.Add(s);
}
}
foreach (ProcessState s in listenersToRemove)
{
m_stateChangeListeners.Remove(s);
}
foreach (ProcessState s in m_stateChangeWaiters.Keys)
{
// Signal waiters
if (s <= m_currentState)
{
foreach (ManualResetEvent w in m_stateChangeWaiters[s])
{
w.Set();
}
waitersToRemove.Add(s);
}
}
foreach (ProcessState s in waitersToRemove)
{
foreach (ManualResetEvent e in m_stateChangeWaiters[s])
{
try
{
e.Close();
}
catch (Exception ex)
{
DryadLogger.LogError(0, ex);
}
}
m_stateChangeWaiters.Remove(s);
}
if (m_currentState == ProcessState.AssignedToNode)
{
m_assignedToNodeEvent.Set();
}
}
else
{
DryadLogger.LogWarning("Change State", "Unexpected state change attempted for process {0}: from {1} to {2}", this.m_id, this.m_currentState.ToString(), newState.ToString());
}
}
}