mattKnight
Programmer
Hi all,
First post in this forum, so pls forgive a newbie...
Background
OS Winnt sp6
Dev Platfom MSVC++ v6 SP5
I recently started "playing" with multi-threading (oh joy)
however I have a problem with CreateThread...
This code is inside simple ATL object (set I think for free thread)
however, It doesn't compile - I get error C2440 at the CreateThread line
the error text reads
I think that this is a scope issue with "ThreadStart", but where should it be (class, global etc)?
All help will be gratefully received
Thanks
Matt
First post in this forum, so pls forgive a newbie...
Background
OS Winnt sp6
Dev Platfom MSVC++ v6 SP5
I recently started "playing" with multi-threading (oh joy)
however I have a problem with CreateThread...
Code:
void CScheduler::Watcher()
{
int x = 5; // arbitary parameter fr new thread
// Start new thread hThread and dwThreadID2 declared as
// class member variables
hThread = CreateThread(NULL,0,
(LPTHREAD_START_ROUTINE)ThreadStart,
(LPVOID)x, 0, &dwThreadID2);
// To do
// useful work and cleanup code (using thread 1)
}
DWORD WINAPI CScheduler::ThreadStart(LPVOID Arg)
{
// to do
// some other useful work
//clean up code
}
This code is inside simple ATL object (set I think for free thread)
however, It doesn't compile - I get error C2440 at the CreateThread line
the error text reads
Code:
'type cast': cannot convert from '' to 'unsigned long )__stdcall *)(void *)'
None of the functions with this name in scope match the target type
I think that this is a scope issue with "ThreadStart", but where should it be (class, global etc)?
All help will be gratefully received
Thanks
Matt