C++ thread 在堆内申请创建线程对象,线程会直接运行而不需要join、detach,这是为什么?

C++ thread 在堆内申请创建线程对象,线程会直接运行而不需要join、detach,这是为什么?
请看相关源码:
#include <iostream>
#include <thread>
#include <functional>
using namespace std;

void test()
{
  cout << "线程已启动" << endl;
  int i = 90;
  while(--i > 0)
  {
    cout << i << endl;
  }
  cout << "线程结束" << endl;
}

int main()
{
  thread *t1 = new thread(test);
  int i = 900000;
  while(--i > 0) ;

  return 0;
}
运行结果:

img

另以下方式也是直接运行,同样让人不解:

  thread th_;
  th_ = thread(test);
  int i = 900000;
  while(--i > 0) ;
我不明白这里为什么可以直接运行,希望在此请教大家

本来就是如此啊
join只是阻塞当前线程,直到线程结束

如果创建一个线程不做处理会调用abort函数终止程序
test1.detach();//这样的话主线程直接结束,不能在终端显示
test1.join();//阻塞,等待子线程结束,才会进行主进程