Number of Threads are more when running Windows Service.

S

sanjay pakale

Guest
Hi all,

I am working on Windows service. I have created 2 worker Threads which will get initiated in OnStart method of the Windows service. The service has handled few events Timer Elapsed, NetWorkChanged, OnPowerEvent & it has OnCustomCommand method implemented. All these events and methods are talking with driver. These all events and methods can execute at same time and driver handles one request at a time. There is a chance of occurring a Race condition.

My question are:

1. when my service starts running I could see there were around 15 threads running(Task Manager Thread number). From where 15 Threads came into my application even though I have created only 2 worker thread and one Main Thread

2. So there are multiple events and override methods are implemented and there is a chance of Race condition, so how to this situation?

Please help me to resolve this issue.

Thanks,

Sanjay

Continue reading...

 
Top Bottom