Thread_test.cc
我因为一些业务原因,需要在Thread.cc里面新增pthread_detach()函数,用于取代join(),但是他直接提示我为空,请问陈硕大佬,这是为什么呀
class test
{
private:
public:
void foo()
{
while (1)
{
}
}
void start()
{
muduo::Thread t1(std::bind(&test::foo, this));
t1.start();
t1.deteach();
}
test() {}
~test() {}
};
int main()
{
test t;
t.start();
while (1)
{
/* code */
}
}