##// END OF EJS Templates
Added ResetState to RunnableComponent to reset in case of failure...
Added ResetState to RunnableComponent to reset in case of failure Added StateChanged event to IRunnable Renamed Promise.SUCCESS -> Promise.Success Added Promise.FromException Renamed Bundle -> PromiseAll in PromiseExtensions

File last commit:

r195:ea485487a424 v2
r205:8200ab154c8a v2
Show More
OperationContext.cs
65 lines | 2.3 KiB | text/x-csharp | CSharpLexer
cin
rewritten tracing
r92 namespace Implab.Diagnostics {
struct OperationContext {
public readonly static OperationContext EMPTY = new OperationContext(LogicalOperation.EMPTY, false);
cin
Improved logging
r134
LogicalOperation m_initial;
cin
rewritten tracing
r92 LogicalOperation m_current;
cin
Improved logging
r134 bool m_ownership;
cin
rewritten tracing
r92
public OperationContext(LogicalOperation operation, bool ownership) {
Safe.ArgumentNotNull(operation, "operation");
m_initial = operation;
m_current = operation;
m_ownership = ownership;
}
public LogicalOperation CurrentOperation {
get { return m_current; }
}
public void BeginLogicalOperation(string name) {
m_current = new LogicalOperation(name, m_current);
}
public LogicalOperation DetachLogicalOperation() {
var detached = m_current;
if (m_current != LogicalOperation.EMPTY) {
if (m_current != m_initial)
m_current = m_current.Parent;
else if (m_ownership)
m_current = LogicalOperation.EMPTY;
cin
improved tracing...
r93 else {
cin
minor changes
r195 TraceLog.TraceWarning("DetachLogicalOperation can't be performed in the current context");
cin
rewritten tracing
r92 detached = LogicalOperation.EMPTY;
cin
improved tracing...
r93 }
} else {
cin
minor changes
r195 TraceLog.TraceWarning("DetachLogicalOperation can't be performed in the current context");
cin
rewritten tracing
r92 }
cin
improved tracing...
r93
cin
rewritten tracing
r92 return detached;
}
cin
Improved logging
r134 public LogicalOperation EndLogicalOperation() {
var current = m_current;
if (m_current != LogicalOperation.EMPTY && (m_current != m_initial || m_ownership)) {
cin
rewritten tracing
r92 m_current = m_current.Parent;
cin
Improved logging
r134 if (current == m_initial) {
// we have complete the owned operation
m_initial = m_current;
m_ownership = false;
}
cin
rewritten tracing
r92 } else {
cin
minor changes
r195 TraceLog.TraceWarning("EndLogicalOperation can't be performed in the current context");
cin
rewritten tracing
r92 }
cin
Improved logging
r134 return current;
cin
rewritten tracing
r92 }
cin
improved tracing...
r93
public void Leave() {
if ((m_ownership && m_current != LogicalOperation.EMPTY) || (!m_ownership && m_current != m_initial) )
TraceLog.TraceWarning("Trying to leave unfinished logical operation {0}", m_current.Name);
}
cin
rewritten tracing
r92 }
}