Skip to content

Instantly share code, notes, and snippets.

@DrPizza
Created August 27, 2012 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DrPizza/3492807 to your computer and use it in GitHub Desktop.
Save DrPizza/3492807 to your computer and use it in GitHub Desktop.
Bogus VC++ 2012 error?
// This is yielding warning C4100: 'data' : unreferenced formal parameter in VC++ 2012.
// which seems bogus. Thoughts?
template <typename T, typename P, typename P2>
HANDLE CreateThread(SECURITY_ATTRIBUTES* sa, SIZE_T stackSize, T* obj, DWORD(T::* func)(P), P2 data, const char* name, DWORD flags, DWORD* tid)
{
typedef DWORD(T::* F)(P);
std::unique_ptr<utility::ThreadInfoMemberFn<T, P, F> > ti(new utility::ThreadInfoMemberFn<T, P, F>(obj, func, data, name));
HANDLE rv(::CreateThread(sa, stackSize, utility::ThreadDispatchMemberFn<T, P, F>, static_cast<void*>(ti.get()), flags, tid));
if(NULL != rv) { ti.release(); }
return rv;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment