📜  c++ thread incide class - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:51.126000             🧑  作者: Mango

代码示例1
#include 
#include 

class foo
{
public:
    void make_foo_func_thread()
    {
        t=std::thread(&foo::foo_func, this);
        t.join();
    }

private:
    std::thread t;
    void foo_func() { std::cout << "Hello\n"; }
};

int main()
{
    foo f;
    f.make_foo_func_thread();
}