1.线程主要包括两部分:1.线程内核对象;2.线程堆栈
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes, // pointer to security attributes
DWORD dwStackSize, // initial thread stack size
LPTHREAD_START_ROUTINE lpStartAddress, // pointer to thread function
LPVOID lpParameter, // argument for new thread
DWORD dwCreationFlags, // creation flags
LPDWORD lpThreadId // pointer to receive thread ID
);
2._beginTheadex,_endTheadex;_beginThead,_endThead.
unsigned long _beginthread( void( __cdecl *start_address )( void * ), unsigned stack_size, void *arglist );
![](https://i-blog.csdnimg.cn/blog_migrate/044918207c2a3c0cabf20ad7d11436a4.png)
unsigned long _beginthreadex( void *security, unsigned stack_size, unsigned ( __stdcall *start_address )( void * ), void *arglist, unsigned initflag, unsigned *thrdaddr );
_endthread, _endthreadex
void _endthread( void );
![](https://i-blog.csdnimg.cn/blog_migrate/044918207c2a3c0cabf20ad7d11436a4.png)
void _endthreadex( unsigned retval );
3.为什么最要用_beginTheadex,_endTheadex
4.线程的的内存模型:1.线程的CPU寄存器(线程上下文);2.线程的堆栈;3.调用的BaseTheadStart
5.线程的结束
6.复制线程