Skip to content

Commit

Permalink
Remove unused scoped_unlock, unlock_guard_try
Browse files Browse the repository at this point in the history
  • Loading branch information
K-ballo committed Feb 19, 2018
1 parent 35bd4d0 commit 10d48f3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 67 deletions.
6 changes: 3 additions & 3 deletions hpx/lcos/local/channel.hpp
Expand Up @@ -19,7 +19,7 @@
#include <hpx/util/atomic_count.hpp>
#include <hpx/util/iterator_facade.hpp>
#include <hpx/util/register_locks.hpp>
#include <hpx/util/scoped_unlock.hpp>
#include <hpx/util/unlock_guard.hpp>
#include <hpx/util/unused.hpp>

#include <boost/intrusive_ptr.hpp>
Expand Down Expand Up @@ -206,7 +206,7 @@ namespace hpx { namespace lcos { namespace local
std::exception_ptr e;

{
util::scoped_unlock<std::unique_lock<mutex_type> > ul(l);
util::unlock_guard<std::unique_lock<mutex_type>> ul(l);
e = HPX_GET_EXCEPTION(
hpx::future_cancelled, hpx::lightweight,
"hpx::lcos::local::close",
Expand Down Expand Up @@ -478,7 +478,7 @@ namespace hpx { namespace lcos { namespace local
// canceled at this point
std::exception_ptr e;
{
util::scoped_unlock<std::unique_lock<mutex_type> > ul(l);
util::unlock_guard<std::unique_lock<mutex_type>> ul(l);
e = std::exception_ptr(
HPX_GET_EXCEPTION(hpx::future_cancelled,
"hpx::lcos::local::close",
Expand Down
33 changes: 0 additions & 33 deletions hpx/util/scoped_unlock.hpp

This file was deleted.

26 changes: 1 addition & 25 deletions hpx/util/unlock_guard.hpp
Expand Up @@ -22,7 +22,7 @@ namespace hpx { namespace util
HPX_NON_COPYABLE(unlock_guard);

public:
typedef Mutex mutex_type;
using mutex_type = Mutex;

explicit unlock_guard(Mutex& m)
: m_(m)
Expand All @@ -38,30 +38,6 @@ namespace hpx { namespace util
private:
Mutex& m_;
};

template <typename Mutex>
class unlock_guard_try
{
public:
HPX_NON_COPYABLE(unlock_guard_try);

public:
typedef Mutex mutex_type;

explicit unlock_guard_try(Mutex& m)
: m_(m)
{
m_.unlock();
}

~unlock_guard_try()
{
m_.try_lock();
}

private:
Mutex& m_;
};
}}

#endif /*HPX_UTIL_UNLOCK_GUARD_HPP*/
4 changes: 2 additions & 2 deletions src/runtime/naming/name.cpp
Expand Up @@ -24,7 +24,7 @@
#include <hpx/util/assert.hpp>
#include <hpx/util/bind.hpp>
#include <hpx/util/logging.hpp>
#include <hpx/util/scoped_unlock.hpp>
#include <hpx/util/unlock_guard.hpp>

#include <boost/io/ios_state.hpp>

Expand Down Expand Up @@ -444,7 +444,7 @@ namespace hpx { namespace naming

std::int64_t result = 0;
{
hpx::util::scoped_unlock<std::unique_lock<gid_type::mutex_type> >
hpx::util::unlock_guard<std::unique_lock<gid_type::mutex_type>>
ul(l);
result = agas::incref(launch::sync, unlocked_gid, added_credit);
}
Expand Down
8 changes: 4 additions & 4 deletions src/util/ini.cpp
Expand Up @@ -27,7 +27,7 @@
#include <hpx/util/assert.hpp>
#include <hpx/util/ini.hpp>
#include <hpx/util/register_locks.hpp>
#include <hpx/util/scoped_unlock.hpp>
#include <hpx/util/unlock_guard.hpp>
#include <hpx/runtime/serialization/serialize.hpp>
#include <hpx/runtime/serialization/map.hpp>

Expand Down Expand Up @@ -486,7 +486,7 @@ void section::add_entry (std::unique_lock<mutex_type>& l,
std::string value = it->second.first;
entry_changed_func f = it->second.second;

hpx::util::scoped_unlock<std::unique_lock<mutex_type> > ul(l);
hpx::util::unlock_guard<std::unique_lock<mutex_type>> ul(l);
f(fullkey, value);
}
}
Expand Down Expand Up @@ -534,7 +534,7 @@ void section::add_entry (std::unique_lock<mutex_type>& l,
std::string value = it->second.first;
entry_changed_func f = it->second.second;

hpx::util::scoped_unlock<std::unique_lock<mutex_type> > ul(l);
hpx::util::unlock_guard<std::unique_lock<mutex_type>> ul(l);
f(fullkey, value);
}
}
Expand All @@ -551,7 +551,7 @@ void section::add_entry (std::unique_lock<mutex_type>& l,
std::string value = p.first->second.first;
entry_changed_func f = p.first->second.second;

hpx::util::scoped_unlock<std::unique_lock<mutex_type> > ul(l);
hpx::util::unlock_guard<std::unique_lock<mutex_type>> ul(l);
f(key, value);
}
}
Expand Down

0 comments on commit 10d48f3

Please sign in to comment.