Whats a good way of writing threaded C++ classes?
> > Ian Emmons wrote: > > > > Baard Bugge wrote: > > > > > > >How would we put the whole object into a thread? > > > > > > Been there. Done that. Let the constructor create a thread before > > > returning to the caller (another object). But beware, your OS will > > > propably start the thread by calling a function (specified by you) > > > C-style. You want this function to be a member function in your class, > > > which is ok as long as you make it static. The thread function will > > > also need the this-pointer to your newly created object. What you want > > > will look something like this (in NT): > > > > > > // Thread callback function. > > > // NOTE: Need to be written in C or be a static member function > > > // because of C style calling convention (no hidden this pointer) > > > LPTHREAD_START_ROUTINE CThread::ThreadFunc(LPVOID inputparam) > > > { > > > CThread *pseudo_this = (CThread *) inputparam; > > > … > > > } > > > > > > This function have access to all the members in th