Created
June 2, 2014 15:16
-
-
Save renestein/b6a61a261d843db548a9 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
private int runTasks(CancellationToken cancellationToken, int maxTasks = UNLIMITED_MAX_TASKS) | |
{ | |
try | |
{ | |
setCurrentThreadAsServiceAllFlags(maxTasks); | |
return runTasksCore(cancellationToken); | |
} | |
finally | |
{ | |
resetThreadAsServiceAllFlags(); | |
} | |
} | |
private void setCurrentThreadAsServiceAllFlags(int maxTasks) | |
{ | |
resetThreadAsServiceAllFlags(); | |
setThreadAsServiceFlag(); | |
m_isServiceThreadFlags.Value.MaxOperationsAllowed = maxTasks; | |
} | |
private void setThreadAsServiceFlag() | |
{ | |
m_isServiceThreadFlags.Value.IsServiceThread = true; | |
} | |
private void resetThreadAsServiceAllFlags() | |
{ | |
m_isServiceThreadFlags.Value.ResetData(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment