Commit 81c01e75 authored by Tiago Peixoto's avatar Tiago Peixoto

Rename scoped_lock to openmp_scoped_lock

This avoids a collapse with std::scoped_lock.

This fixes issue #511.
parent 0a497c91
Pipeline #470 failed with stage
in 484 minutes and 15 seconds
......@@ -1537,7 +1537,7 @@ public:
entropy_args_t& ea, std::vector<double>& dBdx,
int dL)
{
scoped_lock lock(_lock);
openmp_scoped_lock lock(_lock);
size_t r = _b[u];
size_t s = _b[v];
......@@ -2396,7 +2396,7 @@ public:
void enable_partition_stats()
{
scoped_lock lock(_partition_lock);
openmp_scoped_lock lock(_partition_lock);
if (_partition_stats.empty())
{
size_t E = 0;
......
......@@ -531,7 +531,7 @@ struct Layers
if (ea.adjacency || ea.recs || ea.edges_dl || _lcoupled_state != nullptr)
{
scoped_lock lck(_llock);
openmp_scoped_lock lck(_llock);
entropy_args_t lea(ea);
lea.partition_dl = false;
......@@ -1102,7 +1102,7 @@ struct Layers
bool check_layers()
{
scoped_lock lck(_llock);
openmp_scoped_lock lck(_llock);
for (auto v : vertices_range(_g))
{
auto r = _b[v];
......
......@@ -875,7 +875,7 @@ public:
void enable_partition_stats()
{
scoped_lock lock(_partition_lock);
openmp_scoped_lock lock(_partition_lock);
if (_partition_stats.empty())
{
......
......@@ -47,11 +47,11 @@ public:
};
#endif
class scoped_lock
class openmp_scoped_lock
{
public:
explicit scoped_lock(openmp_mutex& m) : _mut(m), _locked(true) { _mut.lock(); }
~scoped_lock() { unlock(); }
explicit openmp_scoped_lock(openmp_mutex& m) : _mut(m), _locked(true) { _mut.lock(); }
~openmp_scoped_lock() { unlock(); }
void unlock() { if(!_locked) return; _locked=false; _mut.unlock(); }
void lock() { if(_locked) return; _mut.lock(); _locked=true; }
private:
......@@ -59,8 +59,8 @@ private:
bool _locked;
// forbid copying
void operator=(const scoped_lock&);
scoped_lock(const scoped_lock&);
void operator=(const openmp_scoped_lock&);
openmp_scoped_lock(const openmp_scoped_lock&);
};
#endif // OPENMP_lOCK_HH
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment