summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-04-21 13:44:37 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-04-21 13:44:37 +0200
commit87dc77ba52b003a89892e48346e140c47a1ebbb6 (patch)
tree6f5acfa64ea0c738c17d9ccf60d6f6660016b192 /sal
parent151a0cec2946b9b8db24d452875071b564d05193 (diff)
Make HASHID work whenever there is std::hash<pthread_t>
Change-Id: I78aecfc7c0ea4ad4467417015bf41b809dbcda83
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/thread.cxx12
1 files changed, 10 insertions, 2 deletions
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;