本网页所有文字内容由 imapbox邮箱云存储,邮箱网盘, iurlBox网页地址收藏管理器 下载并得到。
ImapBox 邮箱网盘 工具地址: https://www.imapbox.com/download/ImapBox.5.5.1_Build20141205_CHS_Bit32.exe
PC6下载站地址:PC6下载站分流下载
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox 网页视频 工具地址: https://www.imapbox.com/download/ImovieBox4.7.0_Build20141115_CHS.exe
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
VOID ExitThread(
DWORD dwExitCode);
dwExitCode 指定此线程之结束代码
没有返回值
这函数有点像C runtime library中的exit()函数,因为他可以在任何时候调用并且绝不会返回。任何代码若放在此行之下,保证不会被执行。
#define WIN32_LEAN_AND_MEAN #include <stdlib.h> #include <stdio.h> #include <Windows.h> DWORD WINAPI ThreadFunc(LPVOID); void AnotherFunc(void); int main() { HANDLE hThrd; DWORD exitCode = 0; DWORD threadId; hThrd = CreateThread(NULL, 0, ThreadFunc, (LPVOID)1, 0, &threadId); if (hThrd) { printf(" Thread launched/n"); } for(;;) { BOOL rc; rc = GetExitCodeThread(hThrd,&exitCode); if (rc && exitCode != STILL_ACTIVE) break; } CloseHandle(hThrd); printf("Thread returned %d/n",exitCode); return EXIT_SUCCESS; } DWORD WINAPI ThreadFunc(LPVOID n) { printf("Thread running/n"); AnotherFunc(); return 0; } void AnotherFunc() { printf("About to exit thread/n"); ExitThread(4); printf("This will never printf/n"); }
线程启动后就执行的那个线程称为主线程(primary thread)。主线程两个特点。第一,他负责GUI(Graphic User Interface)程序中的注销信息循环。第二,这一线程的结束(不论是因为返回或因为调用了exitThread())会使得程序中的所有线程都被强迫结束,程序也因此而结束。其他线程没有机会做清理工作。
阅读和此文章类似的: 程序员专区