Guest User

Untitled

a guest
May 20th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. public static void Callback(this Task task, Action action)
  2. {
  3. Task.Factory.StartNew(sourceTask => {
  4. while (true)
  5. {
  6. if (((Task)sourceTask).IsCompleted)
  7. {
  8. action.Invoke();
  9. return false;
  10. }
  11.  
  12. Thread.Sleep(5000);
  13. }
  14. }, task);
  15. }
Add Comment
Please, Sign In to add comment