From 3fb7845441017b2faf3ec62a15af60a8ad06761e Mon Sep 17 00:00:00 2001 From: vng Date: Thu, 28 Jul 2011 23:20:24 +0300 Subject: [PATCH] Add GetCurrentThreadID finction. --- base/thread.cpp | 9 +++++++++ base/thread.hpp | 2 ++ 2 files changed, 11 insertions(+) diff --git a/base/thread.cpp b/base/thread.cpp index d1a983f942..ae76a7e6d8 100644 --- a/base/thread.cpp +++ b/base/thread.cpp @@ -176,6 +176,15 @@ namespace threads t.tv_nsec =(ms * 1000000) % 1000000000; t.tv_sec = (ms * 1000000) / 1000000000; nanosleep(&t, 0); +#endif + } + + int GetCurrentThreadID() + { +#ifdef OMIM_OS_WINDOWS + return ::GetCurrentThreadId(); +#else + return pthread_self(); #endif } } diff --git a/base/thread.hpp b/base/thread.hpp index f4ed40e768..a539550534 100644 --- a/base/thread.hpp +++ b/base/thread.hpp @@ -47,4 +47,6 @@ namespace threads /// @param[in] ms time-out interval in milliseconds void Sleep(size_t ms); + int GetCurrentThreadID(); + } // namespace threads