Skip to content

Commit

Permalink
Remove 'using namespace' from condition_variable.h (#2020)
Browse files Browse the repository at this point in the history
Signed-off-by: Emerson Knapp <eknapp@amazon.com>
  • Loading branch information
emersonknapp authored Aug 12, 2020
1 parent f7e004d commit b0dcc93
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions clients/roscpp/include/ros/internal/condition_variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,23 @@ class condition_variable_monotonic {
boost::unique_lock<boost::mutex> &lock,
const boost::chrono::time_point<boost::chrono::steady_clock, Duration> &t)
{
using namespace boost::chrono;
typedef time_point<steady_clock, nanoseconds> nano_sys_tmpt;
typedef boost::chrono::time_point<boost::chrono::steady_clock, boost::chrono::nanoseconds>
nano_sys_tmpt;
wait_until(lock,
nano_sys_tmpt(ceil<nanoseconds>(t.time_since_epoch())));
return steady_clock::now() < t ? boost::cv_status::no_timeout : boost::cv_status::timeout;
nano_sys_tmpt(ceil<boost::chrono::nanoseconds>(t.time_since_epoch())));
return boost::chrono::steady_clock::now() < t ?
boost::cv_status::no_timeout :
boost::cv_status::timeout;
}

template <class Clock, class Duration>
boost::cv_status wait_until(
boost::unique_lock<boost::mutex> &lock,
const boost::chrono::time_point<Clock, Duration> &t)
{
using namespace boost::chrono;
steady_clock::time_point s_now = steady_clock::now();
boost::chrono::steady_clock::time_point s_now = boost::chrono::steady_clock::now();
typename Clock::time_point c_now = Clock::now();
wait_until(lock, s_now + ceil<nanoseconds>(t - c_now));
wait_until(lock, s_now + ceil<boost::chrono::nanoseconds>(t - c_now));
return Clock::now() < t ? boost::cv_status::no_timeout : boost::cv_status::timeout;
}

Expand All @@ -127,18 +128,18 @@ class condition_variable_monotonic {
boost::unique_lock<boost::mutex> &lock,
const boost::chrono::duration<Rep, Period> &d)
{
using namespace boost::chrono;
steady_clock::time_point c_now = steady_clock::now();
wait_until(lock, c_now + ceil<nanoseconds>(d));
return steady_clock::now() - c_now < d ? boost::cv_status::no_timeout : boost::cv_status::timeout;
boost::chrono::steady_clock::time_point c_now = boost::chrono::steady_clock::now();
wait_until(lock, c_now + ceil<boost::chrono::nanoseconds>(d));
return boost::chrono::steady_clock::now() - c_now < d ?
boost::cv_status::no_timeout :
boost::cv_status::timeout;
}

boost::cv_status wait_until(
boost::unique_lock<boost::mutex> &lk,
boost::chrono::time_point<boost::chrono::steady_clock, boost::chrono::nanoseconds> tp)
{
using namespace boost::chrono;
nanoseconds d = tp.time_since_epoch();
boost::chrono::nanoseconds d = tp.time_since_epoch();
timespec ts = boost::detail::to_timespec(d);
if (do_wait_until(lk, ts))
return boost::cv_status::no_timeout;
Expand Down

0 comments on commit b0dcc93

Please sign in to comment.