Manually resuming a thread I have inherited a C++ Win32 thread class which roughly works like this. I am looking for ways to improve the design; specifically I am looking for a way to get rid of the spurious Resume() call at the end of initialization. Is there a way this can be automated or omitted?

Base class

class CThread {
public:
    CThread(DWORD dwCreationFlags = 0)
        : m_hThread(Create(ThreadProc, 
                           this, 
                           dwCreationFlags, 
                           NULL, 
                           0, 
                           &amp;m_dwThreadId))
    {}

    DWORD Resume() { return ::ResumeThread(m_hThread); }


protected:
    HANDLE  m_hThread;
    DWORD   m_dwThreadId;

private:
    static HANDLE Create(LPTHREAD_START_ROUTINE pThreadProc,
                         LPVOID pParam = NULL,
                         DWORD dwCreationFlags = 0,
                         LPSECURITY_ATTRIBUTES pSecurityAttr = NULL,
                         DWORD dwStackSize = 0,
                         DWORD *pdwThreadId = NULL)
    {
        /* start thread using _beginthreadex */
        return hThread;
    }

    static DWORD WINAPI ThreadProc(LPVOID p)
    {
        CThread* pThreadObj = reinterpret_cast&lt;CThread *&gt;(p);
        return pThreadObj-&gt;Execute();
    }
};


So now when I make a subclass to start the thread, I need to start it suspended because otherwise it might run without being fully initialized, and then resume it after initialization:

Actual thread implementation class

class CCreateRestorePointThread
        : public CThread
{
    CCreateRestorePointThread(std::wstring const&amp;    name,
                              zRestorePointEventType eventType,
                              zRestorePointType      restorePointType)
/* I think I need to start suspended this so that initialization can take place */
        : CThread(CREATE_SUSPENDED)
        , m_hSrClient(::LoadLibraryW(L"srclient.dll"))
        , m_bRet(FALSE)
        , m_isFinished(false)
    {
        /* Initialize Restore Point System, structures etc. */
        this-&gt;Resume(); /* I wanna get rid of this line */
    }

private:
    DWORD Execute()
    {
        /* Create Restore Point using class members */
        return m_stateMgrStatus.nStatus;
    }    
};
Big Bad Issue:
The callback function for threads libraries are usually a C-function pointer. As such the thread library depends on the callback having a C ABI (not a C++ ABI). This means the function you pass into the threading API must be declared:
extern &quot;C&quot; void* XXXX(void*); // Assuming return and take void* parameters.
                              // Which is basically all you can do with a C API.

Note the extern &quot;C&quot; must be there for it to be a valid C++ program.
You are using a static member function as your callback.
static DWORD WINAPI ThreadProc(LPVOID p)

It may look like it is working but this is just pure coincidence that the ABI for static member function happens to be the same on your platform as the ABI for C functions (there is no requirement in the standard). Nor do any OS that I know give guarantees that they will not change this ABI.
You should declare it like this:
// I also suspect the you are using windows
// They also have some special macro magic you may want to look at to force
// specific calling conventions.:
//
// __cdecl    =&gt;  One of those magic double underscore reserved identifiers.
// http://msdn.microsoft.com/en-us/library/kdzttdcb.aspx
//
extern &quot;C&quot; DWORD WINAPI ThreadProc(LPVOID p)
{
    CThread* pThreadObj = reinterpret_cast&lt;CThread *&gt;(p);
    return pThreadObj-&gt;Execute();
}

class CCreateRestorePointThread: public CThread
{
    friend DWORD WINAPI ThreadProc(LPVOID p);
    ...
};