-
Couldn't load subscription status.
- Fork 238
Open
Description
I was trying to build the library with GCC compiler that comes with ESP IDF SDK for xtensa architecture. Apart from the install section of the CMakeLists.txt that causes issues, the compiler complains about the initialised order of timer_queue class member variables in the constructor initialiser list. Looking at the source code, the error makes sense:
timer_queue::timer_queue(milliseconds max_waiting_time,
const std::function<void(std::string_view thread_name)>& thread_started_callback,
const std::function<void(std::string_view thread_name)>& thread_terminated_callback) :
m_thread_started_callback(thread_started_callback),
m_thread_terminated_callback(thread_terminated_callback), m_atomic_abort(false), m_abort(false), m_idle(true),
m_max_waiting_time(max_waiting_time) {}as m_thread_started_callback and m_thread_terminated_callback are initialised first but they are declared last:
class CRCPP_API timer_queue : public std::enable_shared_from_this<timer_queue> {
...
private:
std::atomic_bool m_atomic_abort;
std::mutex m_lock;
request_queue m_request_queue;
details::thread m_worker;
std::condition_variable m_condition;
bool m_abort;
bool m_idle;
const std::chrono::milliseconds m_max_waiting_time;
const std::function<void(std::string_view thread_name)> m_thread_started_callback;
const std::function<void(std::string_view thread_name)> m_thread_terminated_callback;
...The good news is after fixing the order everything else worked fine (so far). I am wondering how the tests are passed.
Metadata
Metadata
Assignees
Labels
No labels