Add support for using daemon threads (fixes #14)