mirror of https://github.com/PentHertz/srsLTE.git
nas_test: fix TSAN warnings
remove mutex and cvar again that we used to circumvent the startup. we now use a atomic variable to sync the main thread and the stack.
This commit is contained in:
parent
c23034e1a7
commit
8ab512c2be
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "srsran/common/bcd_helpers.h"
|
||||
#include "srsran/common/test_common.h"
|
||||
#include "srsran/common/tsan_options.h"
|
||||
#include "srsran/interfaces/ue_pdcp_interfaces.h"
|
||||
#include "srsran/srslog/srslog.h"
|
||||
#include "srsran/test/ue_test_interfaces.h"
|
||||
|
@ -145,10 +146,7 @@ public:
|
|||
|
||||
void run_thread()
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(init_mutex);
|
||||
running = true;
|
||||
init_cv.notify_all();
|
||||
lk.unlock();
|
||||
while (running) {
|
||||
task_sched.tic();
|
||||
task_sched.run_pending_tasks();
|
||||
|
@ -157,18 +155,15 @@ public:
|
|||
}
|
||||
void stop()
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(init_mutex);
|
||||
while (not running) {
|
||||
init_cv.wait(lk);
|
||||
usleep(1000);
|
||||
}
|
||||
running = false;
|
||||
wait_thread_finish();
|
||||
}
|
||||
pdcp_interface_gw* pdcp = nullptr;
|
||||
srsue::nas* nas = nullptr;
|
||||
bool running = false;
|
||||
std::mutex init_mutex;
|
||||
std::condition_variable init_cv;
|
||||
std::atomic<bool> running = {false};
|
||||
};
|
||||
|
||||
class gw_dummy : public gw_interface_nas, public gw_interface_pdcp
|
||||
|
|
Loading…
Reference in New Issue