我正在尝试将互斥锁句柄传递给子进程槽命令行或任何其他方式.
我怎样才能做到这一点?我如何从孩子那里获得互斥量?
这就是我创建子进程的方式:
HANDLE ghMutex;
if( !CreateProcess( _T("C:\\Users\\Kumppler\\Documents\\Visual Studio 2010\\Projects\\teste3\\Debug\\teste3.exe"), // No module name (use command line)
aux2, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
TRUE, // Set handle inheritance to TRUE
STARTF_USESTDHANDLES, // inherit the standard input, standard output, and standard error handles
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si[j], // Pointer to STARTUPINFO structure
&pi[j] ) // Pointer to PROCESS_INFORMATION structure
)
Run Code Online (Sandbox Code Playgroud)
编辑:
我需要将互斥锁用于多个子进程,可以吗? …