use std::shared pointer to clean up std::thread object