thread safety in Windows Service design [Archive] - C Board

PDA

View Full Version : thread safety in Windows Service design


George2
04-14-2008, 06:25 AM
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