Link to home
Start Free TrialLog in
Avatar of Robert888
Robert888

asked on

Threads with C++

Hi,

Using Visual C++ and the CreateThread function I have a problem with member functions.  If i call CreateThread
as follows

hconin = ::CreateThread(NULL,0,
      (LPTHREAD_START_ROUTINE)                                 WorkerThread,
      0,
      CREATE_SUSPENDED,
      &id);

Where WorkerThread is a global function everything is OK.
But if I define WorkerThread to be a member function of the Class that is calling CreateThread i get an error at compile time.  

error C2440: 'type cast' : cannot convert from 'overloaded function type' to 'unsigned long (__stdcall *)(void *)'

Anyone any ideas

Thanks

Robert

ASKER CERTIFIED SOLUTION
Avatar of dtowell
dtowell

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial