[Libreoffice-commits] core.git: sal/osl
Stephan Bergmann
sbergman at redhat.com
Fri Apr 21 11:45:03 UTC 2017
sal/osl/unx/thread.cxx | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
New commits:
commit 87dc77ba52b003a89892e48346e140c47a1ebbb6
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 21 13:44:37 2017 +0200
Make HASHID work whenever there is std::hash<pthread_t>
Change-Id: I78aecfc7c0ea4ad4467417015bf41b809dbcda83
diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index e829b91781c6..0e235757501b 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -20,6 +20,9 @@
#include <sal/config.h>
#include <cassert>
+#include <cstddef>
+#include <functional>
+
#include "system.hxx"
#include <string.h>
#if defined(OPENBSD)
@@ -553,8 +556,6 @@ void SAL_CALL osl_setThreadName(char const * name) {
/* osl_getThreadIdentifier @@@ see TODO @@@ */
/*****************************************************************************/
-#define HASHID(x) (reinterpret_cast<unsigned long>(x) % HashSize)
-
struct HashEntry
{
pthread_t Handle;
@@ -569,6 +570,13 @@ static pthread_mutex_t HashLock = PTHREAD_MUTEX_INITIALIZER;
static sal_uInt16 LastIdent = 0;
+namespace {
+
+std::size_t HASHID(pthread_t x)
+{ return std::hash<pthread_t>()(x) % HashSize; }
+
+}
+
static sal_uInt16 lookupThreadId (pthread_t hThread)
{
HashEntry *pEntry;
More information about the Libreoffice-commits
mailing list