Guest_imported
New member
- Jan 1, 1970
- 0
diplox (Visitor) May 17, 2001
I'm programming a threaded class but I can't use non-static class function in my thread.
e.g:
void MyClass::dummy()
{
cout <<"lauched..."<<endl
}
void MyClass::launch_thread()
{
mythread = CreateThread( NULL,0,LPTHREAD_START_ROUTINE) dummy,null,0,&dwThreadId);
}
if "dummy" is declared non-static, the systeme say:
"error C2440: 'type cast' : cannot convert from '' to 'unsigned long (__stdcall *)(void *)'"
Has anybody samples which use class method in thread creating. How can I do the cast ?
Someone advises me to overload the operator (), but how can I do that ?
thanks for your answers
dams
I'm programming a threaded class but I can't use non-static class function in my thread.
e.g:
void MyClass::dummy()
{
cout <<"lauched..."<<endl
}
void MyClass::launch_thread()
{
mythread = CreateThread( NULL,0,LPTHREAD_START_ROUTINE) dummy,null,0,&dwThreadId);
}
if "dummy" is declared non-static, the systeme say:
"error C2440: 'type cast' : cannot convert from '' to 'unsigned long (__stdcall *)(void *)'"
Has anybody samples which use class method in thread creating. How can I do the cast ?
Someone advises me to overload the operator (), but how can I do that ?
thanks for your answers
dams