From 5e58a329e6826fe6262077c1276ecf375b014f92 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 25 Jul 2018 09:32:13 +0200 Subject: Make thread check portable --- common/nextpnr.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/nextpnr.h b/common/nextpnr.h index 3ba4f3b3..e89512f2 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -23,10 +23,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -344,7 +344,7 @@ struct BaseCtx { // Lock to perform mutating actions on the Context. std::mutex mutex; - pthread_t mutex_owner; + std::thread::id mutex_owner; // Lock to be taken by UI when wanting to access context - the yield() // method will lock/unlock it when its' released the main mutex to make @@ -377,12 +377,12 @@ struct BaseCtx void lock(void) { mutex.lock(); - mutex_owner = pthread_self(); + mutex_owner = std::this_thread::get_id(); } void unlock(void) { - NPNR_ASSERT(pthread_equal(pthread_self(), mutex_owner) != 0); + NPNR_ASSERT(std::this_thread::get_id() != mutex_owner); mutex.unlock(); } -- cgit v1.2.3