Is there a way in C# to wait until a specific task returns or timeout after a specified number of milliseconds, withOUT making all the other tasks running on the same thread be blocked as well ?
Asked
Active
Viewed 238 times
0
-
3could you provide code you want to solve? – cuongle Jan 31 '13 at 08:55
1 Answers
1
Assuming you are starting the tasks individually, and not using Parallel.For/ForEach/Invoke, etc. i.e. You are getting a Task object back, then something like this:
Task taskIWantToWaitFor = Task.Factory.Start(....);
// Other code
taskIWantToWaitFor.Wait(millisecondsTimeout)
// All other tasks continue in the background

Colin Mackay
- 18,736
- 7
- 61
- 88