Reputation: 105
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 its completion, resuming suspended one. I have a timer to check for thread states, so I can manage processing.
How to do that?
Upvotes: 0
Views: 194
Reputation: 50313
I think that you can benefit from using thread signalling mechanisms such as for example the AutoResetEvent class.
Upvotes: 1
Reputation: 72900
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...
Upvotes: 0