public static Service start(Service self)
{
State state = null;
try
{
lock (m_lock)
{
// start implies install
install(self);
// if already running, short circuit
state = (State)byService[self];
if (state.running) return self;
// put into the running state
state.running = true;
}
// onStart callback (outside of lock)
self.onStart();
}
catch (System.Exception e)
{
if (state != null) state.running = false;
Err.dumpStack(e);
}
return self;
}