12345678910111213141516171819202122232425262728293031323334353637 |
- #include "proc_alive.h"
- #include <util/system/platform.h>
- #include <util/system/compat.h>
- #include <util/system/error.h>
- #include <util/system/winint.h>
- #include <errno.h>
- namespace NYql {
- bool IsProcessAlive(TProcessId pid) {
- #ifdef _unix_
-
-
-
-
- kill(pid, 0);
- return errno != ESRCH;
- #elif defined(_win_)
- HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, pid);
- if (process == NULL) {
- return false;
- }
- DWORD ret = WaitForSingleObject(process, 0);
- CloseHandle(process);
- return ret == WAIT_TIMEOUT;
- #else
- Y_UNUSED(pid);
- return false;
- #endif
- }
- }
|