473,320 Members | 1,832 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,320 software developers and data experts.

Threadpool thread termination.


hi to all folks here,

let's say that i am using a threadpool and somehow, some threads in it just
stuck.
(endless loop or something like that).
So, if it receive a request to run for 25 times something that will stuck,
it simply will not
be able to take more request to dispatch as it will wait for a thread to
become available,
(due to 25 thread limit) something that in this example is not goint to
happen.

Am i able to identify these threads and somehow stop them so the ThreadPool
will be
able to take more request to dispatch ??

thanks a lot for any help,

objectref
Nov 17 '05 #1
4 2484
objectref wrote:
hi to all folks here,

let's say that i am using a threadpool and somehow, some threads in
it just stuck.
(endless loop or something like that).


They're stuck. You had better write them so that they don't go into an
endless loop.

Officially a .NET thread is an abstract unit. In practice in .NET v 1.1
there is a one to one correspondence between .NET threads and OS
threads, and so conceivably you could use Win32 to terminate a thread
pool thread. However terminating a thread in Win32 is not a nice thing
to do because you'll lose data, and so it's best not to do that.

Basically there is no alternative other than making sure that the code
that you'll run on the thread pool thread does not go into an endless
loop. If it's code that yiu do not have access to the source then
metaphorically give them a kick up the arse.

Richard
--
http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Nov 17 '05 #2
objectref,

No, there is no way to do this (and not using the thread pool will not
help either, since you will just end up sucking resources up by using
independent threads until your whole machine comes to a crawl).

Rather, you should identify why those threads are not terminating, and
fix that problem.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"objectref" <ob*******@mediatrel.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...

hi to all folks here,

let's say that i am using a threadpool and somehow, some threads in it
just stuck.
(endless loop or something like that).
So, if it receive a request to run for 25 times something that will stuck,
it simply will not
be able to take more request to dispatch as it will wait for a thread to
become available,
(due to 25 thread limit) something that in this example is not goint to
happen.

Am i able to identify these threads and somehow stop them so the
ThreadPool will be
able to take more request to dispatch ??

thanks a lot for any help,

objectref

Nov 17 '05 #3

objectref wrote:
hi to all folks here,

let's say that i am using a threadpool and somehow, some threads in it just
stuck.
(endless loop or something like that).
So, if it receive a request to run for 25 times something that will stuck,
it simply will not
be able to take more request to dispatch as it will wait for a thread to
become available,
(due to 25 thread limit) something that in this example is not goint to
happen.

Am i able to identify these threads and somehow stop them so the ThreadPool
will be
able to take more request to dispatch ??


How are you gonig to tell the difference between threads that are
'stuck' and threads that are 'taking a long time' ?

--
Larry Lard
Replies to group please

Nov 17 '05 #4

At first thank you all.
How are you gonig to tell the difference between threads that are
'stuck' and threads that are 'taking a long time' ?

--
Larry Lard
Replies to group please

Because the good ones will take no more than a few seconds to complete so i
can easily identify
the bad onew.
Anyway, i finaly used C# 2, i can use the SetMaxThreads so to add some more
threads to the pool and have the whole system
better monitor what is going on.

Again, thank you all!

objectref
Nov 17 '05 #5

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

Similar topics

4
by: David Levine | last post by:
Jon, I've taken a look at it and these comments are based on a code-inspection but I did not verify the correctness if its operation by using it in a sample. The ctor for CustomThreadPool...
6
by: Max Adams | last post by:
Threads and ThreadPool's If I use a ThreadPool how can I tell when a thead in the threadpool has exited? I don't want to set a global member variable I would much rather be able to act on an...
10
by: Lenn | last post by:
Hello, I have always used a certain design pattern for multithreaded Windows app; Start new worker thread from UI thread, use events to notify UI threads when something happens, update UI...
5
by: David Levine | last post by:
Jon, I've taken a look at it and these comments are based on a code-inspection but I did not verify the correctness if its operation by using it in a sample. The ctor for CustomThreadPool...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.