views:

75

answers:

2

Hi,

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?

A: 

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...

David M
its working, but it looks slow, so I don't want to slower one to go and want to make it suspend for the time the new one executes
marshalprince
+1  A: 

I think that you can benefit from using thread signalling mechanisms such as for example the AutoResetEvent class.

Konamiman
Thread Synchronization events is the way to go for this particular scenario. It's the easiest to implement.
Joshua Cauble