Re: Thread count increases

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You ought to use a thread pool for this, creating threads on a per request
basis will cause you to run out of threads rather quickly.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



"John Ballesteros" <JohnBallesteros@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:86694105-7EC9-4DF1-8AA2-5F8DB8472CCB@xxxxxxxxxxxxxxxx
Hello,

I've written a Windows service in C#. This service listens a tcp port and
it creates a new thread with every new socket that arrives. This service
also connects to a SQL Server database through a SQLConnection object.

The question is, how do I know if the number of threads of my service is
right? It's happening things that I don't really understand and I want to
know why?

1. In the first line of the main function the thread count is 3. Why?
2. When the service uses the first time the SQLConnection to populate a
datatable with some usefull information the thread count increases to
7!!!! I
just wanted to execute a Select command syncronously, again why it is
increased so much?
3. With the service running and without any connection arriving, suddenly
the thread count rises to 8, why? my code is in a WaitHandle.WaitAny
waiting
for some manualresetevent to be raised in the callback of the beginaccept
function.
4. When I start a new thread to work with a new socket the thread count is
increased with 3 new threads, I just started one ( I know that every time
I
start a BeginReceive function it starts another thread to monitor the
situation so the framework can execute my callback, but again why 3,
shouldn't it be 2?

Thanks for your help and patience.

John


.



Relevant Pages

  • Re: Completed my pop bumper repairs!
    ...  But there has to be a first time so it's easier the ... I discovered two broken metal armature links. ... socket, armature link, sleeve, and solenoid spring ...
    (rec.games.pinball)
  • Re: Seen it all? board repair funny
    ... first time), but some fool had soldered it in the wrong way around. ... Unfortunatley it was direct to the board no socket. ... once I get a socket and new chip in there. ... No wonder the professional repairers don't want to touch boards that ...
    (rec.games.pinball)
  • Re: Seen it all? board repair funny
    ... first time), but some fool had soldered it in the wrong way around. ... Unfortunatley it was direct to the board no socket. ... once I get a socket and new chip in there. ... No wonder the professional repairers don't want to touch boards that ...
    (rec.games.pinball)
  • Re: Bally -35
    ... Turns out it was the socket at U11. ... One of the traces was shorted to ... I didn't catch it the first time because it was a ... Thanks for everyones help. ...
    (rec.games.pinball)