Created
June 2, 2014 12:45
-
-
Save renestein/c647a1499fcc26f46f82 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 class IoServiceScheduler : TaskSchedulerBase, IAsioTaskService | |
{ | |
public const int REQUIRED_WORK_CANCEL_TOKEN_VALUE = 1; | |
public const int POLLONE_RUNONE_MAX_TASKS = 1; | |
public const int UNLIMITED_MAX_TASKS = -1; | |
private readonly ThreadLocal<IoSchedulerThreadServiceFlags> m_isServiceThreadFlags; | |
private readonly CancellationTokenSource m_stopCancelTokenSource; | |
private readonly BlockingCollection<Task> m_tasks; | |
private readonly object m_workLockObject; | |
private CancellationTokenSource m_workCancelTokenSource; | |
private volatile int m_workCounter; | |
public IoServiceScheduler() | |
{ | |
m_tasks = new BlockingCollection<Task>(); | |
m_isServiceThreadFlags = new ThreadLocal<IoSchedulerThreadServiceFlags>(() => new IoSchedulerThreadServiceFlags()); | |
m_stopCancelTokenSource = new CancellationTokenSource(); | |
m_workLockObject = new object(); | |
m_workCounter = 0; | |
} | |
..... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment