public static Service stop(Service self)
{
try
{
lock (m_lock)
{
// if not running, short circuit
State state = (State)byService[self];
if (state == null || !state.running) return self;
// take out of the running state
state.running = false;
}
// onStop (outside of lock)
self.onStop();
}
catch (System.Exception e)
{
Err.dumpStack(e);
}
return self;
}