diff options
author | Andy Schwerin <schwerin@10gen.com> | 2013-05-23 13:43:28 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@10gen.com> | 2013-06-03 18:53:52 -0400 |
commit | 9b148b0419d79f7173d0e972e8427fea67f77616 (patch) | |
tree | bc9c96a4a82c4384a7d5220b69417eb1835b922c /src/mongo/bson/oid.cpp | |
parent | 06c6c3b6fb835e1bcc62e5f725aca6d815cfb42e (diff) | |
download | mongo-9b148b0419d79f7173d0e972e8427fea67f77616.tar.gz |
SERVER-9809 Replace getpid() with ProcessId::getCurrent() and pid_t with ProcessId.
Diffstat (limited to 'src/mongo/bson/oid.cpp')
-rw-r--r-- | src/mongo/bson/oid.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/mongo/bson/oid.cpp b/src/mongo/bson/oid.cpp index e96b076762a..8847e498159 100644 --- a/src/mongo/bson/oid.cpp +++ b/src/mongo/bson/oid.cpp @@ -20,6 +20,7 @@ #include <boost/functional/hash.hpp> #include "mongo/platform/atomic_word.h" +#include "mongo/platform/process_id.h" #include "mongo/platform/random.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/bson/oid.h" @@ -46,17 +47,9 @@ namespace mongo { return s; } - unsigned OID::ourPid() { -#ifdef _WIN32 - return static_cast<unsigned>( GetCurrentProcessId() ); -#else - return static_cast<unsigned>( getpid() ); -#endif - } - void OID::foldInPid(OID::MachineAndPid& x) { - unsigned p = ourPid(); - x._pid ^= (unsigned short) p; + unsigned p = ProcessId::getCurrent().asUInt32(); + x._pid ^= static_cast<unsigned short>(p); // when the pid is greater than 16 bits, let the high bits modulate the machine id field. unsigned short& rest = (unsigned short &) x._machineNumber[1]; rest ^= p >> 16; |