summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/source/misc/solarmutex.cxx9
-rw-r--r--include/comphelper/solarmutex.hxx4
2 files changed, 6 insertions, 7 deletions
diff --git a/comphelper/source/misc/solarmutex.cxx b/comphelper/source/misc/solarmutex.cxx
index 5d1052327154..3e45ae14582d 100644
--- a/comphelper/source/misc/solarmutex.cxx
+++ b/comphelper/source/misc/solarmutex.cxx
@@ -38,7 +38,6 @@ SolarMutex *SolarMutex::get()
SolarMutex::SolarMutex()
: m_nCount( 0 )
- , m_nThreadId( 0 )
, m_aBeforeReleaseHandler( nullptr )
{
assert(!g_pSolarMutex);
@@ -54,7 +53,7 @@ void SolarMutex::doAcquire( const sal_uInt32 nLockCount )
{
for ( sal_uInt32 n = nLockCount; n ; --n )
m_aMutex.acquire();
- m_nThreadId = osl::Thread::getCurrentIdentifier();
+ m_nThreadId = std::this_thread::get_id();
m_nCount += nLockCount;
}
@@ -72,7 +71,7 @@ sal_uInt32 SolarMutex::doRelease( bool bUnlockAll )
{
if ( m_aBeforeReleaseHandler )
m_aBeforeReleaseHandler();
- m_nThreadId = 0;
+ m_nThreadId = std::thread::id();
}
for ( sal_uInt32 n = nCount ; n ; --n )
@@ -83,14 +82,14 @@ sal_uInt32 SolarMutex::doRelease( bool bUnlockAll )
bool SolarMutex::IsCurrentThread() const
{
- return m_nThreadId == osl::Thread::getCurrentIdentifier();
+ return m_nThreadId == std::this_thread::get_id();
}
bool SolarMutex::tryToAcquire()
{
if ( m_aMutex.tryToAcquire() )
{
- m_nThreadId = osl::Thread::getCurrentIdentifier();
+ m_nThreadId = std::this_thread::get_id();
m_nCount++;
return true;
}
diff --git a/include/comphelper/solarmutex.hxx b/include/comphelper/solarmutex.hxx
index 4094e08ee1f7..f9af16f1d3ad 100644
--- a/include/comphelper/solarmutex.hxx
+++ b/include/comphelper/solarmutex.hxx
@@ -24,8 +24,8 @@
#include <assert.h>
#include <atomic>
+#include <thread>
-#include <osl/thread.h>
#include <osl/mutex.hxx>
#include <comphelper/comphelperdllapi.h>
@@ -72,7 +72,7 @@ protected:
sal_uInt32 m_nCount;
private:
- std::atomic<oslThreadIdentifier> m_nThreadId;
+ std::atomic<std::thread::id> m_nThreadId;
SolarMutex(const SolarMutex&) = delete;
SolarMutex& operator=(const SolarMutex&) = delete;