Last active
August 29, 2015 14:02
-
-
Save renestein/864d957ac59b9f3d59cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public virtual Task Post(Action action) | |
{ | |
checkIfDisposed(); | |
if (action == null) | |
{ | |
throw new ArgumentNullException("action"); | |
} | |
return postInner(() => Dispatch(action)); | |
} | |
public virtual Task Post(Func<Task> function) | |
{ | |
checkIfDisposed(); | |
if (function == null) | |
{ | |
throw new ArgumentNullException("function"); | |
} | |
return postInner(() => Dispatch(function)); | |
} | |
private Task postInner(Func<Task> dispatcher) | |
{ | |
bool oldIsInServiceThread = m_isServiceThreadFlags.Value.IsServiceThread; | |
try | |
{ | |
clearCurrentThreadAsServiceFlag(); | |
return dispatcher(); | |
} | |
finally | |
{ | |
m_isServiceThreadFlags.Value.IsServiceThread = oldIsInServiceThread; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment