resolved the uninit variable issue in the queue_test

This commit is contained in:
Francisco Paisana 2019-09-17 17:52:18 +01:00 committed by Andre Puschmann
parent 14267640ee
commit 7e67aee839
2 changed files with 7 additions and 6 deletions

View File

@ -104,7 +104,7 @@ int test_multiqueue_threading()
{
std::cout << "\n===== TEST multiqueue threading test: start =====\n";
int capacity = 4, number, start_number = 2, nof_pushes = capacity + 1;
int capacity = 4, number = 0, start_number = 2, nof_pushes = capacity + 1;
multiqueue_handler<int> multiqueue(capacity);
int qid1 = multiqueue.add_queue();
auto push_blocking_func = [&multiqueue](int qid, int start_value, int nof_pushes, bool* is_running) {
@ -190,9 +190,9 @@ int test_multiqueue_threading3()
multiqueue_handler<int> multiqueue(capacity);
int qid1 = multiqueue.add_queue();
auto pop_blocking_func = [&multiqueue](int qid, bool* success) {
int number;
int id = multiqueue.wait_pop(&number);
*success = id < 0;
int number = 0;
int id = multiqueue.wait_pop(&number);
*success = id < 0;
};
bool t1_success = false;

View File

@ -208,8 +208,9 @@ void ue_stack_lte::run_thread()
{
while (running) {
task_t task{};
pending_tasks.wait_pop(&task);
task();
if (pending_tasks.wait_pop(&task) >= 0) {
task();
}
}
}