Last active
June 28, 2017 09:51
-
-
Save Criteo-dotnet-blog/ed78d76f1c8b0709867ac4853ff758c7 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
| private static string GetTaskState(ulong flag) | |
| { | |
| TaskStatus rval; | |
| if ((flag & TASK_STATE_FAULTED) != 0) rval = TaskStatus.Faulted; | |
| else if ((flag & TASK_STATE_CANCELED) != 0) rval = TaskStatus.Canceled; | |
| else if ((flag & TASK_STATE_RAN_TO_COMPLETION) != 0) rval = TaskStatus.RanToCompletion; | |
| else if ((flag & TASK_STATE_WAITING_ON_CHILDREN) != 0) rval = TaskStatus.WaitingForChildrenToComplete; | |
| else if ((flag & TASK_STATE_DELEGATE_INVOKED) != 0) rval = TaskStatus.Running; | |
| else if ((flag & TASK_STATE_STARTED) != 0) rval = TaskStatus.WaitingToRun; | |
| else if ((flag & TASK_STATE_WAITINGFORACTIVATION) != 0) rval = TaskStatus.WaitingForActivation; | |
| else if (flag == 0) rval = TaskStatus.Created; | |
| else return null; | |
| return rval.ToString(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment