The correct (standard) way to do this on C and Windows is with __beginthreadex.
This is usually preferred to calling CreateThread directly as CreateThread doesn’t init C runtime support for the thread. So if you create a thread using CreateThread, and call a CRT function, bad stuff can/will happen.
Note that __beginthreadex calls CreateThread internally, but performs some other work behind the scenes.
solved Best way to multi-thread? [closed]