From a20a8b18ad99da3e7b0a05e4c30f19c880e865d9 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 30 Jul 2018 14:57:17 +0200 Subject: [PATCH] fix rlc_stress_test, stop RLC instances and remove hard thread canceling --- lib/test/upper/rlc_stress_test.cc | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/lib/test/upper/rlc_stress_test.cc b/lib/test/upper/rlc_stress_test.cc index d48011667..ec02a699a 100644 --- a/lib/test/upper/rlc_stress_test.cc +++ b/lib/test/upper/rlc_stress_test.cc @@ -113,7 +113,6 @@ public: fail_rate = fail_rate_; opp_sdu_ratio = opp_sdu_ratio_; run_enable = true; - running = false; pdu_tx_delay_usec = pdu_tx_delay_usec_; pcap = pcap_; is_dl = is_dl_; @@ -123,21 +122,12 @@ public: void stop() { run_enable = false; - int cnt=0; - while(running && cnt<100) { - usleep(10000); - cnt++; - } - if(running) { - thread_cancel(); - } wait_thread_finish(); } private: void run_thread() { - running = true; byte_buffer_t *pdu = byte_buffer_pool::get_instance()->allocate("mac_reader::run_thread"); if (!pdu) { printf("Fatal Error: Could not allocate PDU in mac_reader::run_thread\n"); @@ -163,7 +153,6 @@ private: } } } - running = false; byte_buffer_pool::get_instance()->deallocate(pdu); } @@ -175,9 +164,7 @@ private: rlc_pcap *pcap; uint32_t lcid; bool is_dl; - bool run_enable; - bool running; }; class mac_dummy @@ -227,7 +214,6 @@ public: rlc_tester(rlc_interface_pdcp *rlc_, std::string name_, uint32_t sdu_gen_delay_usec_, uint32_t lcid_){ rlc = rlc_; run_enable = true; - running = false; rx_pdus = 0; name = name_; sdu_gen_delay_usec = sdu_gen_delay_usec_; @@ -237,14 +223,6 @@ public: void stop() { run_enable = false; - int cnt=0; - while(running && cnt<100) { - usleep(10000); - cnt++; - } - if(running) { - thread_cancel(); - } wait_thread_finish(); } @@ -275,7 +253,6 @@ private: void run_thread() { uint8_t sn = 0; - running = true; while(run_enable) { byte_buffer_t *pdu = byte_buffer_pool::get_instance()->allocate("rlc_tester::run_thread"); if (!pdu) { @@ -292,11 +269,9 @@ private: rlc->write_sdu(lcid, pdu); if (sdu_gen_delay_usec) usleep(sdu_gen_delay_usec); } - running = false; } bool run_enable; - bool running; long rx_pdus; uint32_t lcid; @@ -381,6 +356,10 @@ void stress_test(stress_test_args_t args) usleep(1e6); } + // Stop RLC instances first to release blocking writers + rlc1.stop(); + rlc2.stop(); + tester1.stop(); tester2.stop(); mac.stop();