Commit 8ab26a0b authored by Joseph Noir's avatar Joseph Noir

Remove extern C and clean up soem comments

Extern C is not included in the RIOT headers.
parent 65fbdbbe
...@@ -27,10 +27,8 @@ ...@@ -27,10 +27,8 @@
#ifdef __RIOTBUILD_FLAG #ifdef __RIOTBUILD_FLAG
extern "C" {
#include "time.h" #include "time.h"
#include "vtimer.h" #include "vtimer.h"
}
namespace caf { namespace caf {
......
...@@ -24,15 +24,13 @@ ...@@ -24,15 +24,13 @@
#ifdef __RIOTBUILD_FLAG #ifdef __RIOTBUILD_FLAG
#include "mutex.hpp" #include "sched.h"
#include "vtimer.h"
#include "caf/chrono.hpp" #include "caf/mutex.hpp"
#include "caf/chrono.hpp"
extern "C" {
#include "sched.h"
#include "vtimer.h"
}
namespace caf { namespace caf {
...@@ -116,7 +114,7 @@ cv_status condition_variable::wait_for(unique_lock<mutex>& lock, ...@@ -116,7 +114,7 @@ cv_status condition_variable::wait_for(unique_lock<mutex>& lock,
timex_t timeout, before, after; timex_t timeout, before, after;
auto s = duration_cast<seconds>(timeout_duration); auto s = duration_cast<seconds>(timeout_duration);
timeout.seconds = s.count(); timeout.seconds = s.count();
timeout.microseconds = (duration_cast<microseconds>(timeout_duration) - s).count(); timeout.microseconds = (duration_cast<microseconds>(timeout_duration - s)).count();
vtimer_now(&before); vtimer_now(&before);
vtimer_t timer; vtimer_t timer;
vtimer_set_wakeup(&timer, timeout, sched_active_pid); vtimer_set_wakeup(&timer, timeout, sched_active_pid);
......
...@@ -23,16 +23,11 @@ ...@@ -23,16 +23,11 @@
#ifdef __RIOTBUILD_FLAG #ifdef __RIOTBUILD_FLAG
#include "mutex.h"
#include <utility> #include <utility>
//#include <system_error>
#include <stdexcept> #include <stdexcept>
#include <cstdio>
extern "C" {
#include "mutex.h"
}
namespace caf { namespace caf {
class mutex { class mutex {
...@@ -94,15 +89,6 @@ class unique_lock { ...@@ -94,15 +89,6 @@ class unique_lock {
: m_mtx{&mtx}, m_owns{ mtx.try_lock() } { } : m_mtx{&mtx}, m_owns{ mtx.try_lock() } { }
inline unique_lock(mutex_type& mtx, adopt_lock_t) inline unique_lock(mutex_type& mtx, adopt_lock_t)
: m_mtx{&mtx}, m_owns{true} { } : m_mtx{&mtx}, m_owns{true} { }
// template<class Clock, class Duration>
// inline unique_lock(mutex_type& mtx,
// const std::chrono::time_point<Clock,
// Duration>& timeout_time)
// : m_mtx{&mtx}, m_owns{mtx.try_lock_until(timeout_time)} { }
// template<class Rep, class Period>
// inline unique_lock(mutex_type& mtx,
// const chrono::duration<Rep,Period>& timeout_duration)
// : m_mtx{&mtx}, m_owns{mtx.try_lock_for(timeout_duration)} { }
inline ~unique_lock() { inline ~unique_lock() {
if (m_owns) { if (m_owns) {
m_mtx->unlock(); m_mtx->unlock();
...@@ -183,34 +169,6 @@ bool unique_lock<Mutex>::try_lock() { ...@@ -183,34 +169,6 @@ bool unique_lock<Mutex>::try_lock() {
return m_owns; return m_owns;
} }
//template<class Mutex>
//template<class Rep, class Period>
//bool unique_lock<Mutex>
// ::try_lock_for(const std::chrono::duration<Rep,Period>& timeout_duration) {
// if (m_mtx == nullptr) {
// throw std::runtime_error("unique_lock::try_lock_for: references null mutex");
// }
// if (m_owns) {
// throw std::runtime_error("unique_lock::try_lock_for: already locked");
// }
// m_owns = m_mtx->try_lock_until(timeout_duration);
// return m_owns;
//}
//template <class Mutex>
//template <class Clock, class Duration>
//bool unique_lock<Mutex>
// ::try_lock_until(const chrono::time_point<Clock, Duration>& timeout_time) {
// if (m_mtx == nullptr)
// throw std::runtime_error("unique_lock::try_lock_until: "
// "references null mutex");
// if (m_owns)
// throw std::runtime_error("unique_lock::try_lock_until: "
// "already locked");
// m_owns = m_mtx->try_lock_until(timeout_time);
// return m_owns;
//}
template<class Mutex> template<class Mutex>
void unique_lock<Mutex>::unlock() { void unique_lock<Mutex>::unlock() {
if (!m_owns) { if (!m_owns) {
......
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
#ifdef __RIOTBUILD_FLAG #ifdef __RIOTBUILD_FLAG
#include "time.h"
#include "thread.h"
#include "kernel_internal.h"
#include <tuple> #include <tuple>
#include <memory> #include <memory>
#include <utility> #include <utility>
...@@ -31,12 +35,6 @@ ...@@ -31,12 +35,6 @@
#include <functional> #include <functional>
#include <type_traits> #include <type_traits>
extern "C" {
#include "time.h"
#include "thread.h"
#include "kernel_internal.h"
}
#include "caf/mutex.hpp" #include "caf/mutex.hpp"
#include "caf/chrono.hpp" #include "caf/chrono.hpp"
#include "caf/ref_counted.hpp" #include "caf/ref_counted.hpp"
......
...@@ -21,12 +21,10 @@ ...@@ -21,12 +21,10 @@
#include <cstdio> #include <cstdio>
#include <stdexcept> #include <stdexcept>
extern "C" {
#include "irq.h" #include "irq.h"
#include "sched.h" #include "sched.h"
#include "vtimer.h" #include "vtimer.h"
#include "priority_queue.h" #include "priority_queue.h"
}
#include "caf/condition_variable.hpp" #include "caf/condition_variable.hpp"
......
...@@ -18,9 +18,7 @@ ...@@ -18,9 +18,7 @@
* http://www.boost.org/LICENSE_1_0.txt. * * http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/ ******************************************************************************/
extern "C" {
#include "vtimer.h" #include "vtimer.h"
}
#include <cerrno> #include <cerrno>
#include <system_error> #include <system_error>
......
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