It is written as a macro definition. This is because it is difficult to convert the type of the parameter values every time.
#define BEGINTHREADEX(psa, cbStack, pfnStartAddr, \
pvParam, fdwCreate, pdwThreadId) \
((HANDLE)_beginthreadex( \
(void *) (psa), \
(unsigned) (cbStack), \
(PTHREAD_START) (pfnStartAddr), \
(void *) (pvParam), \
(unsigned) (fdwCreate), \
(unsigned*) (pdwThreadId)))
Unsignedlong _ beginthreadex (void * security, unsigned stack_size, unsigned (_ stdcall * start_address) (void *), void * arglist, unsigned initflag, unsigned * thrdaddr );
// 1st parameters: Security Attribute. NULL is the default security attribute.
// 2nd parameters: Specifies the thread stack size. If it is 0, the thread stack size is the same as that of the thread that created it. Generally, 0 is used.
// 3rd parameters: Specify the address of the thread function, that is, the address of the function called and executed by the thread (use the function name to indicate the address)
// 4th parameters: the pointer of the parameter passed to the thread. You can pass in the object pointer and then convert it to the pointer of the corresponding class in the thread function.
// 5th parameters: the initial state of the thread; 0: run immediately; CREATE_SUSPEND: suincluded (suspended)
// 6th parameters: the address used to record the thread ID
FangSH
2011-01-05