- Use fprintf in the srsran_assert context incase the assert is being triggered by srslog producing a circular loop.

- Switch to use a dynamic circular buffer for the log backend queue.
This commit is contained in:
faluco 2021-03-25 10:38:00 +01:00 committed by faluco
parent 4b5e15cd70
commit 3c1a97f450
2 changed files with 6 additions and 5 deletions

View File

@ -13,8 +13,8 @@
#ifndef SRSRAN_ASSERT_H
#define SRSRAN_ASSERT_H
#include "srsran/common/standard_streams.h"
#include "srsran/srslog/srslog.h"
#include <cstdio>
#ifdef ASSERTS_ENABLED
@ -27,6 +27,7 @@
#define srsran_assert(condition, fmt, ...) \
do { \
if (srsran_unlikely(not(condition))) { \
std::fprintf(stderr, "%s:%d: " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__); \
std::abort(); \
} \
} while (0)

View File

@ -27,12 +27,12 @@ namespace detail {
template <typename T, size_t capacity = SRSLOG_QUEUE_CAPACITY>
class work_queue
{
srsran::static_circular_buffer<T, capacity> queue;
mutable condition_variable cond_var;
static constexpr size_t threshold = capacity * 0.98;
srsran::dyn_circular_buffer<T> queue;
mutable condition_variable cond_var;
static constexpr size_t threshold = capacity * 0.98;
public:
work_queue() = default;
work_queue() : queue(capacity) {}
work_queue(const work_queue&) = delete;
work_queue& operator=(const work_queue&) = delete;