Please report new issues athttps://github.com/DOCGroup
The NT_Service example (essentially unchanged between ACE 5.3 and 5.4) has a -d option that causes the example to run as an ordinary process rather than as a service. But even with this option the program makes service-related calls. In particular, Service::svc calls ACE_NT_Service::report_status, which calls SetServiceStatus. According to <http://msdn.microsoft.com/library/en-us/dllproc/base/setservicestatus.asp>, "A service can call [SetServiceStatus] only after it has called RegisterServiceCtrlHandlerEx to get a service status handle," and with the -d option the example does not do this. (The program also calls SetConsoleCtrlHandler to register a handler that calls Service::handle_control, which also calls report_status.) A comment in Service::svc indicates that the example assumes that report_status returns -1 when the program is not being run as a service, but neither SetServiceStatus nor report_status claims to properly handle this condition. Probably Process::run should handle opt_debug by starting the reactor without using the Service instance at all. Or ACE_NT_Service::report_status should not call SetServiceStatus if this->svc_handle_ is null.
Accepted.