Skip to content

Instantly share code, notes, and snippets.

@cdacamar
Created July 15, 2016 04:17
Show Gist options
  • Save cdacamar/e0afb184ea68404c8b3437406464e033 to your computer and use it in GitHub Desktop.
Save cdacamar/e0afb184ea68404c8b3437406464e033 to your computer and use it in GitHub Desktop.
DWORD WINAPI DoThing( LPVOID );
DWORD ThreadID; // why?
auto threadHandle = CreateThread(
NULL, // default security attributes
0, // default stack size
(LPTHREAD_START_ROUTINE) DoThing,
NULL, // no thread function arguments
0, // default creation flags
&ThreadID); // receive thread identifier
if( threadHandle == NULL ) // NULL is advisable here since HANDLE _could_ be just an int
{
auto err = GetLastError();
std::cout<<"CreateThread error: "<<err<<'\n';
// quit here, presumabily
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment