Last active
August 29, 2015 14:02
-
-
Save renestein/f7282b497c693c9a06f9 to your computer and use it in GitHub Desktop.
This file contains 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 Dispatch(Action action) | |
{ | |
checkIfDisposed(); | |
if (action == null) | |
{ | |
throw new ArgumentNullException("action"); | |
} | |
var task = Task.Factory.StartNew(action, | |
CancellationToken.None, | |
TaskCreationOptions.None, | |
ProxyScheduler.AsTplScheduler()); | |
return task; | |
} | |
public virtual Task Dispatch(Func<Task> function) | |
{ | |
checkIfDisposed(); | |
if (function == null) | |
{ | |
throw new ArgumentNullException("function"); | |
} | |
var task = Task.Factory.StartNew(function, | |
CancellationToken.None, | |
TaskCreationOptions.None, | |
ProxyScheduler.AsTplScheduler()).Unwrap(); | |
return task; | |
} | |
public override void QueueTask(Task task) | |
{ | |
checkIfDisposed(); | |
m_tasks.Add(task); | |
} | |
private bool isInServiceThread() | |
{ | |
return m_isServiceThreadFlags.Value.IsServiceThread; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment