3
Reply

thread safety in Windows Service design

George George

George George

Apr 14 2008 8:29 AM
1.9k

Hello everyone,


For Windows Service, for example class Service1 is the main class of my service application, which derives from ServiceBase. I am wondering whether it is possible that two concurrent access to the following 3 cases?

1. the constructor of Service1;
2. OnStart method of Service1;
3. OnStop method of Service.

If yes, I need some synchronizaton control in them. If yes, in what situation the three methods will be called concurrently? We are able to start/stop the same service with different instances (processes) at the same time?


thanks in advance,
George


Answers (3)