mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
63 lines
2.4 KiB
Diff
63 lines
2.4 KiB
Diff
diff --git lib-src/PlainHashIndexTable.hh lib-src/PlainHashIndexTable.hh
|
|
index 068460d..9dff216 100644
|
|
--- lib-src/PlainHashIndexTable.hh
|
|
+++ lib-src/PlainHashIndexTable.hh
|
|
@@ -15,8 +15,8 @@
|
|
|
|
#include <vector>
|
|
|
|
-#include <mutex>
|
|
-#include <shared_mutex>
|
|
+#include <boost/thread/mutex.hpp>
|
|
+#include <boost/thread/shared_mutex.hpp>
|
|
#include <atomic>
|
|
|
|
#include "Global.hh"
|
|
@@ -55,7 +55,7 @@ namespace topcom {
|
|
index_table_type _index_data;
|
|
mutable bool _preprocessed;
|
|
mutable bool _inside_multithreading;
|
|
- mutable std::shared_mutex _index_data_mutex;
|
|
+ mutable boost::shared_mutex _index_data_mutex;
|
|
public:
|
|
// constructors:
|
|
inline PlainHashIndexTable(const bool inside_multithreading = false) :
|
|
@@ -91,7 +91,7 @@ namespace topcom {
|
|
_preprocessed = phit._preprocessed;
|
|
}
|
|
else {
|
|
- std::unique_lock<std::shared_mutex> _index_data_guard(_index_data_mutex);
|
|
+ std::unique_lock<boost::shared_mutex> _index_data_guard(_index_data_mutex);
|
|
key_table_type::operator=(phit);
|
|
_index_data = phit._index_data;
|
|
_preprocessed = phit._preprocessed;
|
|
@@ -117,8 +117,8 @@ namespace topcom {
|
|
return _index_data[index];
|
|
}
|
|
else {
|
|
- // std::unique_lock<std::shared_mutex> _index_data_guard(_index_data_mutex);
|
|
- std::shared_lock<std::shared_mutex> _index_data_guard(_index_data_mutex);
|
|
+ // std::unique_lock<boost::shared_mutex> _index_data_guard(_index_data_mutex);
|
|
+ boost::shared_lock<boost::shared_mutex> _index_data_guard(_index_data_mutex);
|
|
return _index_data[index];
|
|
}
|
|
}
|
|
@@ -142,7 +142,7 @@ namespace topcom {
|
|
if (_inside_multithreading) {
|
|
{
|
|
// std::lock_guard<std::mutex> _index_data_guard(_index_data_mutex);
|
|
- std::unique_lock<std::shared_mutex> _index_data_guard(_index_data_mutex);
|
|
+ std::unique_lock<boost::shared_mutex> _index_data_guard(_index_data_mutex);
|
|
auto finder(key_table_type::find(key));
|
|
if (finder != key_table_type::end()) {
|
|
return finder->second;
|
|
@@ -150,7 +150,7 @@ namespace topcom {
|
|
}
|
|
// write access from here - guard:
|
|
// std::lock_guard<std::mutex> _index_data_guard(_index_data_mutex);
|
|
- std::unique_lock<std::shared_mutex> _index_data_guard(_index_data_mutex);
|
|
+ std::unique_lock<boost::shared_mutex> _index_data_guard(_index_data_mutex);
|
|
const size_type new_index(_index_data.size());
|
|
key_table_type::insert(std::pair<Key, size_type>(key, new_index));
|
|
// _index_data.resize(new_index + 1);
|