Threading Windows

B

Bob Day

Using VS 2003, VB.NET, MSDE ...

I am surprised that certain things are creating threads listed in debugging
threading window (with no name or information, just the ID).

For example, the opening an SQL connection creates a thread, that remains
after the connection is closed. Such as the line below.
' test that SQL server is functioning by opening connnection. Note
that this tries repeatedly, so there is a delay before it errors out if it
is unavailable.

CD_Temp.Cnn_For_CSolutionDatabaseSQL.Open()

The name of the thread before and after the .OPEN line above is
"Main_Thread" (as expected), but in the threads window after the .OPEN line
it adds a new thread that says:

ID Name Location Priority

736 <No Name> (blank) Highest

Why is this created? Can I/Should I .abort the thread (I don't see how)?
Should I worry about it? Will garbage collection eventually get rid of it
anyway?

Does .NET create its own threads to do things (such as above) behind the
scenes, or do threads have to be explictly created in code? (obvisouly,
based on this post, I guess the first part or that statement is accurate).

Thanks

Bob
 
P

Patrick Steele [MVP]

Why is this created? Can I/Should I .abort the thread (I don't see how)?
Should I worry about it? Will garbage collection eventually get rid of it
anyway?

Why created -- who knows. It's part of the implementation. And no, I
wouldn't worry about it. And no, if it's not your thread you shoulnd't
abort it (in fact, you might not even have permission to abort a thread
that isn't yours).
Does .NET create its own threads to do things (such as above) behind the
scenes, or do threads have to be explictly created in code? (obvisouly,
based on this post, I guess the first part or that statement is accurate).

Yes, .NET creates a thread for the garbage collector and it might create
an additional one for the finalizer queue (not sure on this one though).
 
P

Peter Huang

Hi Bob,

Thanks for posting in the community.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you observe that when you do a
connecting to a SQL server, there will be a new thread created.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I agree with Patrick's answer, I think for performance concern, the .NET
runtime will create such thread to improve the performance and you do not
need to abort them, .NET runtime will manage it.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang

Hi Bob,

Thanks for posting in the community.

Did my reply answer your question?
I would appreciate if you could provide an update by posting a message in
the Newsgroup thread letting us know whether the information provided in
the response was useful in resolving the issue. If you still have
questions, please reply to the thread to let us know you need further
assistance.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

threading problem 1
Threading in .Net... 4
Threading a form 1
threading question 1
Basic Threading question 19
Multi-Threading 9
Threading 1
Threading 1

Top