fix rlc_stress_test, stop RLC instances and remove hard thread canceling

This commit is contained in:
Andre Puschmann 2018-07-30 14:57:17 +02:00
parent 1160dac54f
commit a20a8b18ad
1 changed files with 4 additions and 25 deletions

View File

@ -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();