Created
January 9, 2020 06:39
-
-
Save arcticmatt/f04cdeea66223a2a52ffaa74ad8fa7bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename Function> | |
class RaiiThread { | |
public: | |
RaiiThread(Function &&f) : t_(f){}; | |
~RaiiThread() { | |
std::cout << "Joining thread in ~RaiiThread" << std::endl; | |
t_.join(); | |
}; | |
private: | |
std::thread t_; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment