我需要将APC的线程句柄传递给另一个进程,以便能够将QueueUserAPC调用到src线程中:
处理SMconsumerThread;
if (!DuplicateHandle(GetCurrentProcess(),// src server thread
GetCurrentThread(),
GetCurrentProcess(),// target is any client
(HANDLE*)&SMconsumerThread,
THREAD_SET_CONTEXT, // only permission required by QueueUserAPC
FALSE, // not inheritable
0)) // no options
{
printf("cannot server thread handle");
}
怎么做,因为GetCurrentProcess / GetCurrentThread在调用者进程中返回伪句柄-1,我找到了在进程间传递套接字的解释:http://tangentsoft.net/wskfaq/articles/passing-sockets.html
是否有任何示例或解释如何复制线程句柄?