术语 | threadproc |
释义 | ThreadProc 语法: C++ DWORD WINAPI ThreadProc( __in LPVOID lpParameter ); ThreadProc回调函数 应用程序定义的函数作为一个线程起始地址服务。指定这个地址时调用CreateThread,CreateRemoteThread的,或CreateRemoteThreadEx功能。 在LPTHREAD_START_ROUTINE类型定义一个指向这个回调函数。 ThreadProc是一个应用程序的占位符定义函数的名称。 参数 lpParameter [in] 该线程传递给函数使用的CreateThread,CreateRemoteThread的,或CreateRemoteThreadEx功能lpParameter参数数据。 返回值 返回值表示的成功或本功能衰竭。 不要宣布其返回类型为void此回调函数和函数指针强制转换为LPTHREAD_START_ROUTINE在创建线程。的代码,这是不常见,但它可以坠毁在64位Windows。 备注 一个进程可以决定什么时候它创建线程已经通过使用等职能之一完成。它还可以通过调用函数的GetExitCodeThread其ThreadProc返回值。 每个线程都收到本函数的局部变量独特的副本。任何静态或共享全局变量在这一进程的所有线程。为了提供独特的数据,每个线程使用全球指数,使用线程本地存储。 实例 有关示例,请参阅创建线程。 要求: 最低支持:client-Windows 2000专业版 最低支持server-Windows 2000服务器 HeaderWinbase.h(头文件:winuser.h) 参见 CreateThread CreateRemoteThread的 CreateRemoteThreadEx GetExitCodeThread 如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com) 生成日期:2009年8月27日 ==英文原文==ThreadProc Callback Function An application-defined function that serves as the starting address for a thread. Specify this address when calling the CreateThread , CreateRemoteThread , or CreateRemoteThreadEx function. The LPTHREAD_START_ROUTINE type defines a pointer to this callback function. ThreadProc is a placeholder for the application-defined function name. Syntax C++ DWORD WINAPI ThreadProc( __in LPVOID lpParameter ); Parameters lpParameter [in] The thread data passed to the function using the lpParameter parameter of the CreateThread , CreateRemoteThread , or CreateRemoteThreadEx function. Return Value The return value indicates the success or failure of this function. Do not declare this callback function with a void return type and cast the function pointer to LPTHREAD_START_ROUTINE when creating the thread. Code that does this is common, but it can crash on 64-bit Windows. Remarks A process can determine when a thread it created has completed by using one of the wait functions . It can also obtain the return value of its ThreadProc by calling the GetExitCodeThread function. Each thread receives a unique copy of the local variables of this function. Any static or global variables are shared by all threads in the process. To provide unique data to each thread using a global index, use thread local storage . Examples For an example, see Creating Threads . Requirements Minimum supported clientWindows 2000 Professional Minimum supported serverWindows 2000 Server HeaderWinbase.h (include Windows.h) See Also CreateThread CreateRemoteThread CreateRemoteThreadEx GetExitCodeThread Send comments about this topic to Microsoft Build date: 8/27/2009 ==原始网址==http://msdn.microsoft.com/en-us/library/ms686736(VS.85).aspx\n |
随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。