Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ thread incide class

#include <iostream>
#include <thread>

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
"; }
};

int main()
{
    foo f;
    f.make_foo_func_thread();
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #thread #incide #class
ADD COMMENT
Topic
Name
9+7 =