eliminated old way to schedule tasks using the heap

This commit is contained in:
Francisco Paisana 2020-04-16 18:04:14 +01:00 committed by Francisco Paisana
parent d40dcd28f3
commit 28467d568d
6 changed files with 7 additions and 40 deletions

View File

@ -165,6 +165,9 @@ private:
template <typename R, typename... Args, size_t Capacity>
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
#endif // SRSLTE_MOVE_CALLBACK_H

View File

@ -302,38 +302,7 @@ private:
uint32_t nof_threads_waiting = 0;
};
/***********************************************************
* 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()>;
//! Specialization for tasks
using task_multiqueue = multiqueue_handler<move_task_t>;
} // namespace srslte

View File

@ -19,7 +19,7 @@
*
*/
#include "srslte/common/multiqueue.h"
#include "srslte/common/move_callback.h"
#include <functional>
#include <list>
#include <memory>
@ -74,7 +74,7 @@ class callback_group_t
{
public:
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
callback_id_t on_next_call(callback_t f_)

View File

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

View File

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

View File

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