eliminated old way to schedule tasks using the heap

master
Francisco Paisana 5 years ago committed by Francisco Paisana
parent d40dcd28f3
commit 28467d568d

@ -165,6 +165,9 @@ private:
template <typename R, typename... Args, size_t Capacity> template <typename R, typename... Args, size_t Capacity>
constexpr task_details::empty_table_t<R, Args...> move_callback<R(Args...), Capacity>::empty_table; constexpr task_details::empty_table_t<R, Args...> move_callback<R(Args...), Capacity>::empty_table;
//! Generic move task
using move_task_t = move_callback<void()>;
} // namespace srslte } // namespace srslte
#endif // SRSLTE_MOVE_CALLBACK_H #endif // SRSLTE_MOVE_CALLBACK_H

@ -302,38 +302,7 @@ private:
uint32_t nof_threads_waiting = 0; uint32_t nof_threads_waiting = 0;
}; };
/*********************************************************** //! Specialization for tasks
* Specialization for tasks with content that is move-only
**********************************************************/
template <typename... Args>
class move_function
{
public:
move_function() = default;
template <typename Func>
move_function(Func&& f) : task_ptr(new derived_task<Func>(std::forward<Func>(f)))
{}
void operator()(Args&&... args) { (*task_ptr)(std::forward<Args>(args)...); }
private:
struct base_task {
virtual ~base_task() {}
virtual void operator()(Args&&...) = 0;
};
template <typename Func>
struct derived_task : public base_task {
derived_task(Func&& f_) : f(std::forward<Func>(f_)) {}
void operator()(Args&&... args) final { f(std::forward<Args>(args)...); }
private:
Func f;
};
std::unique_ptr<base_task> task_ptr;
};
using move_task_t = move_callback<void()>;
using task_multiqueue = multiqueue_handler<move_task_t>; using task_multiqueue = multiqueue_handler<move_task_t>;
} // namespace srslte } // namespace srslte

@ -19,7 +19,7 @@
* *
*/ */
#include "srslte/common/multiqueue.h" #include "srslte/common/move_callback.h"
#include <functional> #include <functional>
#include <list> #include <list>
#include <memory> #include <memory>
@ -74,7 +74,7 @@ class callback_group_t
{ {
public: public:
using callback_id_t = uint32_t; using callback_id_t = uint32_t;
using callback_t = srslte::move_function<Args...>; using callback_t = srslte::move_callback<void(Args...)>;
//! register callback, that gets called once //! register callback, that gets called once
callback_id_t on_next_call(callback_t f_) callback_id_t on_next_call(callback_t f_)

@ -28,7 +28,6 @@
#include "srslte/asn1/s1ap_asn1.h" #include "srslte/asn1/s1ap_asn1.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/common/interfaces_common.h" #include "srslte/common/interfaces_common.h"
#include "srslte/common/multiqueue.h"
#include "srslte/common/security.h" #include "srslte/common/security.h"
#include "srslte/interfaces/sched_interface.h" #include "srslte/interfaces/sched_interface.h"
#include <vector> #include <vector>

@ -38,7 +38,6 @@
#include "srslte/asn1/liblte_mme.h" #include "srslte/asn1/liblte_mme.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/common/interfaces_common.h" #include "srslte/common/interfaces_common.h"
#include "srslte/common/multiqueue.h"
#include "srslte/common/security.h" #include "srslte/common/security.h"
#include "srslte/common/stack_procedure.h" #include "srslte/common/stack_procedure.h"
#include "srslte/common/tti_point.h" #include "srslte/common/tti_point.h"

@ -518,10 +518,7 @@ bool nas::paging(s_tmsi_t* ue_identity)
return false; return false;
} }
// once completed, call paging complete // once completed, call paging complete
rrc_connector.then([this](proc_state_t outcome) { rrc_connector.then([this](proc_state_t outcome) { rrc->paging_completed(outcome.is_success()); });
rrc->paging_completed(outcome.is_success());
return proc_outcome_t::success;
});
callbacks.add_proc(rrc_connector); callbacks.add_proc(rrc_connector);
} else { } else {
nas_log->warning("Received paging while in state %s\n", emm_state_text[state]); nas_log->warning("Received paging while in state %s\n", emm_state_text[state]);

Loading…
Cancel
Save