Improving support for non-daemon background threads

I ended up going in a different direction for solving this problem in my own use cases. See Daemon threads and background task termination for details on that idea.