Improve thread management

This asserts that the internal thread pool is shutdown before booting
and also tracks all threads while busy.