I read on stackoverflow that when using the Windows API to start a thread _beginthreadex() is preferred over CreateThread().
I am creating threads like this using CreateThread():
DWORD WINAPI ThreadFunc(void* data)
{
// code for the thread functionality.
}
HANDLE Multicast = CreateThread(NULL, 0, ThreadFunc, NULL, 0, NULL);
if (Multicast) { } // thread started successfully.
How do I do this with _beginthreadex() rather than CreateThread()?
Can anyone post an example?
should do the trick for you. You can ignore those additional parameters as most of those are optional.
The following SO links might be useful for you:
Windows threading: _beginthread vs _beginthreadex vs CreateThread C++
_beginthread vs CreateThread