Thread controlling function as non-global
Posted on 1998-10-27
I am using Visual c++ 5 to join two previous c++ programs and am using multithreading to let them run simultaneously.
I have built the GUI in a project and would like to add the other program to run as a worker thread when required.
I wan't the worker thread to have access to members of MFC classes in the original GUI thread. The problem I am having is in calling the worker thread from within a member function of the GUI thread.
I am trying to do this with code like this:
AfxBeginThread( (AFX_THREADPROC ) CMatchThread::MatchThreadProc, m_pPose);
where the actual controlling function is defined in the CMatchThread class as follows:
static UINT MatchThreadProc(LPVOID);
The error I get is this:
error C2440: 'type cast' : cannot convert from 'overloaded function type' to 'unsigned int (__cdecl *)(void *)'
None of the functions with this name in scope match the target type
I can't understand what's wrong with my typecast, I know it's possible to declare the controlling function as a non-global, where am I going wrong?