Is it really alright to make thread with new & delete is working properly?
Q1. trying to make new thread by using new is alright?
Q2, Is there no problem delete th after join?
example
class Myclass {
private:
thread *th;
public:
~Myclass(){delete th;};
void create_thread();
void thread_func();
};
Myclass::create_thread()
{
th = new thread(thread_func, this);
th->join();
}
Myclass::thread_func()
{
while(1){};
}