win api启动结束线程

发布时间 2024-01-09 17:46:36作者: YiXiaoKezz

static unsigned int  __stdcall helper_thread_proc(void * para)
{
  //code
  return 0;
}

static HANDLE start_helper_thread()
{
  HANDLE hdl;
  hdl = (HANDLE)_beginthreadex(NULL, 0, parse_thread_proc, NULL, 0, NULL);
  return hdl;
}

HANDLE hdl = NULL;
hdl = start_helper_thread();
//
if(hdl != NULL)
{
  WaitForSingleObject(hdl, INFINITE);
  CloseHandle(hdl);
}