diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-25 09:32:13 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-25 09:32:13 +0200 |
commit | 5e58a329e6826fe6262077c1276ecf375b014f92 (patch) | |
tree | c7479acf8c03924c4072c15b3c63377c55ba114a | |
parent | 8b60ed5fd1bda845b4d3f8ac727f5b285713ff0e (diff) | |
download | nextpnr-5e58a329e6826fe6262077c1276ecf375b014f92.tar.gz nextpnr-5e58a329e6826fe6262077c1276ecf375b014f92.tar.bz2 nextpnr-5e58a329e6826fe6262077c1276ecf375b014f92.zip |
Make thread check portable
-rw-r--r-- | common/nextpnr.h | 8 |
1 files changed, 4 insertions, 4 deletions
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 <condition_variable> #include <memory> #include <mutex> -#include <pthread.h> #include <stdexcept> #include <stdint.h> #include <string> +#include <thread> #include <unordered_map> #include <unordered_set> #include <vector> @@ -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(); } |