创建多线程
我在vs2008中使用多线程方法,使用c++语言。当我使用 _beginthreadex
函数时,出现以下错误:
error C2664: '_beginthreadex' : cannot convert parameter 3 from 'unsigned int
(__stdcall *)(void *)' to 'unsigned int (__stdcall *)(void *)'
ps: 我在 threadFunc 上使用模板,如下所示:
template
,然后我创建线程
_beginthreadex(NULL,0,closingReconstruction_ThreadFunc<T>,(PVOID)(tPara+i),0,NULL)
,所以我得到这个错误,当然,如果我删除模板,它可以工作,但我需要使用模板,有什么方法可以解决这个问题。
I use Multi-thread method in vs2008 ,use c++ language. when I use _beginthreadex
function, I got the follow error:
error C2664: '_beginthreadex' : cannot convert parameter 3 from 'unsigned int
(__stdcall *)(void *)' to 'unsigned int (__stdcall *)(void *)'
ps: I use the template on the threadFunc like this:
template<class T>
unsigned int WINAPI closingReconstruction_ThreadFunc(void* pvPara)
{...}
,and then i creat the thread
_beginthreadex(NULL,0,closingReconstruction_ThreadFunc<T>,(PVOID)(tPara+i),0,NULL)
so i get this error , of course , if I remove the template ,it can be work,but i need to use template, are there any methods to solve this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您忘记提及前面的错误消息,
让我声明一下,首先查看第一条错误消息通常是一个好主意。
干杯&呵呵,,
You forgot to mention the immediately preceding error message,
Let me just state that looking at the first error message first, is generally a good idea.
Cheers & hth.,