473,396 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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?

--
Regards
Sharon G.
Nov 16 '05 #1
4 3496
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/<32**********************************@microsoft.co m>

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?
Nov 16 '05 #2
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.

----------------------------------------------------
"Richard Blewett [DevelopMentor]" wrote:

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/<32**********************************@microsoft.co m

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?
Nov 16 '05 #3
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.

----------------------------------------------------
"Richard Blewett [DevelopMentor]" wrote:

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/<32**********************************@microsoft.co m

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?
Nov 16 '05 #4
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
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Graeme Matthew | last post by:
Hi all I just cannot seem to find any documentation that shows an example of using the factory method Event() in threads. I have a thread pool and if there are no jobs in a Queue I want them to...
44
by: Charles Law | last post by:
Hi guys. I'm back on the threading gig again. It's the age-old question about waiting for something to happen without wasting time doing it. Take two threads: the main thread and a worker...
7
by: Morris | last post by:
I want to abort a running thread, so I call MyThread.abort() function. My problem is this thread runs "almost" like a while(true) loop and I don't want the Abort() function interrupts the thread at...
5
by: Kishore Gopalan | last post by:
Hi, I'm using thread from a .NET Thread pool. And I assign some data in the thread during the time of its processing in Thread Local Storage. When the process gets over and the thread goes back...
7
by: [Yosi] | last post by:
Hi, I create a thread which load DLL and have DLL function call,this Dll function takes a lot of time. My Question is , if I request Thread.Susspend(), and the thread is inside the Dll function...
2
by: Rakesh | last post by:
Hey, I am using delegates for asynchoronus communication. Its internally use threads from thread pool. I want to know whether this thread pool is on Application level or System level? If...
9
by: Abhishek Srivastava | last post by:
Hello All, In IIS 6.0 We have a concept of worker processes and application pools. As I understand it, we can have multiple worker process per appliction pool. Each worker process is dedicated...
1
by: mingki | last post by:
Hi Developers, I am a .Net developer of a Large Online Retailling Company. I would like to have your help on a Connection Pool issue. Recently we have developed a Web Application on ODP .Net...
5
by: Alan T | last post by:
I will do several things in my thread: Copy a file to a location Update database record Read the file content Write the content to a log file If I call Thread.Abort(), it may be possible to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.