windows:
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
if (hProc)
{
if (TerminateProcess(hProc, 0) == 0)
{
CloseHandle(hProc);
throw SystemException("cannot kill process");
}
CloseHandle(hProc);
}
linux:
kill(pid, SIGKILL)
本文转自 hakuyo 51CTO博客,原文链接:http://blog.51cto.com/hakuyo/1283389,如需转载请自行联系原作者