Commit c47eea61 authored by Joseph Noir's avatar Joseph Noir

Remove old code

parent 1594d7cc
...@@ -161,11 +161,9 @@ class unique_lock { ...@@ -161,11 +161,9 @@ class unique_lock {
template<class Mutex> template<class Mutex>
void unique_lock<Mutex>::lock() { void unique_lock<Mutex>::lock() {
if (m_mtx == nullptr) { if (m_mtx == nullptr) {
//std::__throw_system_error(EPERM, "unique_lock::lock: references null mutex");
throw std::runtime_error("unique_lock::lock: references null mutex"); throw std::runtime_error("unique_lock::lock: references null mutex");
} }
if (m_owns) { if (m_owns) {
//std::__throw_system_error(EDEADLK, "unique_lock::lock: already locked");
throw std::runtime_error(""); throw std::runtime_error("");
} }
m_mtx->lock(); m_mtx->lock();
...@@ -175,11 +173,9 @@ void unique_lock<Mutex>::lock() { ...@@ -175,11 +173,9 @@ void unique_lock<Mutex>::lock() {
template<class Mutex> template<class Mutex>
bool unique_lock<Mutex>::try_lock() { bool unique_lock<Mutex>::try_lock() {
if (m_mtx == nullptr) { if (m_mtx == nullptr) {
//std::__throw_system_error(EPERM,
throw std::runtime_error("unique_lock::try_lock: references null mutex"); throw std::runtime_error("unique_lock::try_lock: references null mutex");
} }
if (m_owns) { if (m_owns) {
//std::__throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
throw std::runtime_error("unique_lock::try_lock lock: already locked"); throw std::runtime_error("unique_lock::try_lock lock: already locked");
} }
m_owns = m_mtx->try_lock(); m_owns = m_mtx->try_lock();
...@@ -191,12 +187,10 @@ bool unique_lock<Mutex>::try_lock() { ...@@ -191,12 +187,10 @@ bool unique_lock<Mutex>::try_lock() {
//bool unique_lock<Mutex> //bool unique_lock<Mutex>
// ::try_lock_for(const std::chrono::duration<Rep,Period>& timeout_duration) { // ::try_lock_for(const std::chrono::duration<Rep,Period>& timeout_duration) {
// if (m_mtx == nullptr) { // if (m_mtx == nullptr) {
// std::__throw_system_error(EPERM, "unique_lock::try_lock_for:" // throw std::runtime_error("unique_lock::try_lock_for: references null mutex");
// " references null mutex");
// } // }
// if (m_owns) { // if (m_owns) {
// std::__throw_system_error(EDEADLK, // throw std::runtime_error("unique_lock::try_lock_for: already locked");
// "unique_lock::try_lock_for: already locked");
// } // }
// m_owns = m_mtx->try_lock_until(timeout_duration); // m_owns = m_mtx->try_lock_until(timeout_duration);
// return m_owns; // return m_owns;
...@@ -207,10 +201,10 @@ bool unique_lock<Mutex>::try_lock() { ...@@ -207,10 +201,10 @@ bool unique_lock<Mutex>::try_lock() {
//bool unique_lock<Mutex> //bool unique_lock<Mutex>
// ::try_lock_until(const chrono::time_point<Clock, Duration>& timeout_time) { // ::try_lock_until(const chrono::time_point<Clock, Duration>& timeout_time) {
// if (m_mtx == nullptr) // if (m_mtx == nullptr)
// __throw_system_error(EPERM, "unique_lock::try_lock_until: " // throw std::runtime_error("unique_lock::try_lock_until: "
// "references null mutex"); // "references null mutex");
// if (m_owns) // if (m_owns)
// __throw_system_error(EDEADLK, "unique_lock::try_lock_until: " // throw std::runtime_error("unique_lock::try_lock_until: "
// "already locked"); // "already locked");
// m_owns = m_mtx->try_lock_until(timeout_time); // m_owns = m_mtx->try_lock_until(timeout_time);
// return m_owns; // return m_owns;
...@@ -219,7 +213,6 @@ bool unique_lock<Mutex>::try_lock() { ...@@ -219,7 +213,6 @@ bool unique_lock<Mutex>::try_lock() {
template<class Mutex> template<class Mutex>
void unique_lock<Mutex>::unlock() { void unique_lock<Mutex>::unlock() {
if (!m_owns) { if (!m_owns) {
//std::__throw_system_error(EPERM, "unique_lock::unlock: not locked");
throw std::runtime_error("unique_lock::unlock: not locked"); throw std::runtime_error("unique_lock::unlock: not locked");
} }
m_mtx->unlock(); m_mtx->unlock();
......
...@@ -63,7 +63,6 @@ void condition_variable::notify_all() noexcept { ...@@ -63,7 +63,6 @@ void condition_variable::notify_all() noexcept {
void condition_variable::wait(unique_lock<mutex>& lock) noexcept { void condition_variable::wait(unique_lock<mutex>& lock) noexcept {
if (!lock.owns_lock()) { if (!lock.owns_lock()) {
// std::__throw_system_error(EPERM,
throw std::runtime_error("condition_variable::wait: mutex not locked"); throw std::runtime_error("condition_variable::wait: mutex not locked");
} }
priority_queue_node_t n; priority_queue_node_t n;
...@@ -90,7 +89,6 @@ void condition_variable::wait(unique_lock<mutex>& lock) noexcept { ...@@ -90,7 +89,6 @@ void condition_variable::wait(unique_lock<mutex>& lock) noexcept {
time_point<system_clock, time_point<system_clock,
nanoseconds> tp) noexcept { nanoseconds> tp) noexcept {
if (!lock.owns_lock()) { if (!lock.owns_lock()) {
//std::__throw_system_error(EPERM,
throw std::runtime_error("condition_variable::timed wait: mutex not locked"); throw std::runtime_error("condition_variable::timed wait: mutex not locked");
} }
nanoseconds d = tp.time_since_epoch(); nanoseconds d = tp.time_since_epoch();
......
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