Portable C++98 thread class akin to std::thread
You can put the unsafe_args in a auto_ptr so RAII can delete them safely. This is safe because you will not be copying it around.

static PORTABLE_THREAD_FUNC_DECL thunk(void *unsafe_args)
{
    std::auto_ptr&lt;TThunkArg&gt; args(reinterpret_cast&lt;TThunkArg*&gt;(unsafe_args));
    args-&gt;Self-&gt;m_func(args-&gt;Arg0);

    return 0;
}


Also don't worry about having to new the args; you are creating a new thread, this is much more expensive than a quick malloc call.