I have a connundrum in the use of the mfc function
AfxBeginThread(AFX_THREADPROC pfnThreadProc,
LPVOID pParam,
int nPriority = THREAD_PRIORITY_NORMAL,
UINT nStackSize = 0,
DWORD dwCreateFlags = 0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL
);
Apparently the type AFX_THREADPROC is a reference. It is what worked. So in a class (constructor) I call this function to start a thread with thread routing call it MyThreadProc() is referenced as follows.
pfnThreadProc = &MyThreadProc;
I copied this usage from another program, which MyThreadProc() defined outside the class (call it USBCom). This worked fine. The thread got started. I debugged it to completion just fine. Great. Then I realized this thread routine had to call other member function to get it's worker thread duties done. I tried calling inside like
.. USBCom:MyMemberFunc() ..
to no avail. So then I moved this MyThreadProc() to within my class USBCom. Compiling I couldn't use this instanciation of AfxBeginThread().
I suppose the &MyThreadProc() was the problem (what it pointed to). Probably some standard about not allowing addresses of member functions being passed around -- that whole encapsulation thang.
So how do I fix this predicament. Where I can start a thread in a class where the thread proc is outside the class yet has access or perview to to member functions within the class that started it.
As some background this thread's purpose will be to read both the status of the USB Ports I am using as well as data being sent to me via USB 2.0. I have performance milestones to meet, so I wish this be lean. How do I do it??
Maddog
ps: I am communication with an FDDi FT240XS USB FIFO.