How to pool another thread out of a wait state???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I wish to control other threads, that are warped with my own classes, so when
they are in any wait state (lock(), Monitor.Wait(), ReadWriteLock.Wait(),
Mutex.Wait(), AutoResetEvent.Wait(), ManualResetEvent.Wait()) I’ll be able to
take them out of the wait state even if the object which they are waiting on
is not signaled (still blocking).

How can I do that?
 
Call Interrupt ont the thread, it wakes a thread up from a wait state by throwing a ThreadInterruptedException on that thread.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

I wish to control other threads, that are warped with my own classes, so when
they are in any wait state (lock(), Monitor.Wait(), ReadWriteLock.Wait(),
Mutex.Wait(), AutoResetEvent.Wait(), ManualResetEvent.Wait()) I'll be able to
take them out of the wait state even if the object which they are waiting on
is not signaled (still blocking).

How can I do that?
 
The Interrupt looks too cruel. By using it I can not tell the interrupted
thread who interrupted him or why.
And what about the exception? Isn’t it too much? Isn’t there any nicer way?
I thought that something like that would be done by the ThreadPool.

Thanks & Regsrsd
Sharon G.

----------------------------------------------------
:

Call Interrupt on the thread, it wakes a thread up from a wait state by
throwing a ThreadInterruptedException on that thread.

Regards
Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

---------------------------------------------------
nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]

I wish to control other threads, that are warped with my own classes, so
when they are in any wait state (lock(), Monitor.Wait(), ReadWriteLock.Wait(),
Mutex.Wait(), AutoResetEvent.Wait(), ManualResetEvent.Wait()) I'll be able to
take them out of the wait state even if the object which they are waiting on
is not signaled (still blocking).

How can I do that?
 
The Interrupt looks too cruel. By using it I can not tell the interrupted
thread who interrupted him or why.
And what about the exception? Isn’t it too much? Isn’t there any nicer way?
I thought that something like that would be done by the ThreadPool.

Thanks & Regsrsd
Sharon G.

----------------------------------------------------
:

Call Interrupt on the thread, it wakes a thread up from a wait state by
throwing a ThreadInterruptedException on that thread.

Regards
Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

---------------------------------------------------
nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]

I wish to control other threads, that are warped with my own classes, so
when they are in any wait state (lock(), Monitor.Wait(), ReadWriteLock.Wait(),
Mutex.Wait(), AutoResetEvent.Wait(), ManualResetEvent.Wait()) I'll be able to
take them out of the wait state even if the object which they are waiting on
is not signaled (still blocking).

How can I do that?
 
Hi,
The Interrupt looks too cruel. By using it I can not tell the interrupted
thread who interrupted him or why.
And what about the exception? Isn’t it too much? Isn’t there any nicer way?
I thought that something like that would be done by the ThreadPool.

What do you think are monitors and events for?
They are not intented to be "broken" just for kicks.
If you really want this, then you have to interrupt the thread
and handle the resulting exception.

See that fine article:

http://www.yoda.arachsys.com/csharp/threads/

bye
Rob
 
Back
Top