我正在尝试使用_beginthreadex进行一些基本的并行化,并按照我给出的示例传递参数,但它不起作用.
有任何想法吗?
#include <iostream>
#include <process.h>
void MyThread(void *data)
{
std::cout << "Hello World!";
}
int main()
{
_beginthreadex(NULL, 0, MyThread, NULL, 0, NULL);
while(true);
}
Run Code Online (Sandbox Code Playgroud)
编辑:
为什么不将NULL作为参数传递工作?(因为该函数无论如何都没有参数?)
传递NULL作为参数列表与_beginthread一起工作正常.