Skip to content

Instantly share code, notes, and snippets.

@wayt
Created December 8, 2013 16:15
Show Gist options
  • Save wayt/7859628 to your computer and use it in GitHub Desktop.
Save wayt/7859628 to your computer and use it in GitHub Desktop.
class Thread
{
public:
Thread(std::function<void(void)> &func) : _thread(func) {}
template<class T>
Thread(T& obj) : _thread(boost::bind(&T::run, &obj)) {}
void join() { _thread.join(); }
static void Sleep(unsigned int ms) { boost::this_thread::sleep(boost::posix_time::milliseconds(ms)); }
private:
boost::thread _thread;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment