killing seems bad  why kill  just stop it using an event object  for example def heartbeat self while self coordinator is not none and not self  dead is set do stuff def stop self stuff if self coordinator is not none self coordinator stop self  dead set if self  ev is not none self  ev wait self  ev none self coordinator none self started false