Thread Joining or Thread suspending\resuming in c#
In windows form application, I am creating a thread for some work and in between if your clicks for some other work, then I need to suspend earlier thread and need to do new task(high priority) first and after i开发者_运维知识库ts completion, resuming suspended one. I have a timer to check for thread states, so I can manage processing.
How to do that?
I think that you can benefit from using thread signalling mechanisms such as for example the AutoResetEvent class.
Can't you manage this just by setting the priority of the background thread lower than that of the thread that manages the UI? Don't reinvent the wheel...
精彩评论