thread-mainloop: add more logs for thread termination and thread join