SleepQueue: sleep_entry_t don't extends std::enable_shared_from_this<sleep_entry_t> anymore

This commit is contained in:
DHrpcs3 2015-12-21 16:46:58 +02:00
parent d2619e94ec
commit 8807d85677
2 changed files with 8 additions and 3 deletions

View File

@ -2,12 +2,17 @@
#include <deque>
#include <memory>
struct sleep_entry_t : protected std::enable_shared_from_this<sleep_entry_t>
struct sleep_entry_t
{
virtual void sleep() = 0;
virtual void awake() = 0;
virtual std::shared_ptr<sleep_entry_t> shared_sleep_entry() = 0;
friend class sleep_queue_entry_t;
template<typename Type>
std::shared_ptr<Type> as_shared_ptr()
{
return std::static_pointer_cast<Type>(shared_sleep_entry());
}
};
using sleep_queue_t = std::deque<std::shared_ptr<sleep_entry_t>>;

View File

@ -2,7 +2,7 @@
void sleep_queue_entry_t::add_entry()
{
m_queue.emplace_back(std::static_pointer_cast<sleep_entry_t>(m_thread.shared_from_this()));
m_queue.emplace_back(m_thread.shared_sleep_entry());
}
void sleep_queue_entry_t::remove_entry()