2019-07-07 09:38:00 +00:00
|
|
|
import std/os
|
2018-12-19 10:27:48 +00:00
|
|
|
export os
|
|
|
|
|
|
|
|
when defined(windows):
|
|
|
|
import winlean
|
|
|
|
else:
|
|
|
|
import posix
|
|
|
|
|
2019-05-08 20:05:16 +00:00
|
|
|
when not declared(getCurrentProcessId):
|
|
|
|
proc getCurrentProcessId*(): int =
|
|
|
|
## return current process ID. See also ``osproc.processID(p: Process)``.
|
|
|
|
when defined(windows):
|
|
|
|
proc GetCurrentProcessId(): DWORD {.stdcall, dynlib: "kernel32",
|
2018-12-19 10:27:48 +00:00
|
|
|
importc: "GetCurrentProcessId".}
|
2019-05-08 20:05:16 +00:00
|
|
|
GetCurrentProcessId().int
|
|
|
|
else:
|
|
|
|
getpid()
|
2018-12-19 10:27:48 +00:00
|
|
|
|