What's the difference between the getmypid()
and the posix_getpid()
functions?
I turned to getmypid()
because my script has to run both on Windows and on Linux.
What's the difference between the getmypid()
and the posix_getpid()
functions?
I turned to getmypid()
because my script has to run both on Windows and on Linux.
It seems the main difference is what you said :
getmypid
works both on windows and linuxposix_getpid
does not work on windows, as stated here
I guess the second one exists to be kinda POSIX-compliant (if there are others POSIX functions, why not this one ? )
So, if you want your code to be portable, you'll use the first one -- as you did.