gracefully stop processes (for real)

HM and TCPU threads are never joined. Indeed, they are detached at the end of the main function.

Implement a stop mechanism, so that threads can clean their things up.