Monitoring tasks

So the problem is that I have a class ThreadManagerthat uses a queue to store objects Task; ThreadManagercan start Taskby calling the method Task Start()from which the stream will be generated to run some algorithm (the actual "task"). Now I want to ThreadManagerkeep track of the status of the task flow (generated using the Start()object method Task).

For this, it seems to me that I need to create a thread for monitoring in ThreadManager, and I need the task thread to fire events to notify the monitor thread that I finished, or I get some error, so the monitor can handle this event accordingly.

Guru, please tell me if my idea is applicable? And if so, how to achieve this workflow? Many thanks!

+1
source share
2 answers

Task.ContinueWith, , . , ( Start()) - , . , , , . - Action<Task>, . task.Status, .

/ .

+3

, Task.IsCompleted Task, . , ?

0

All Articles