diff --git a/input_dev.c b/input_dev.c index c42d3e6..4892773 100644 --- a/input_dev.c +++ b/input_dev.c @@ -568,8 +568,7 @@ static void input_udev( } } - // const int timeout_ms = 1200; 40% usage - const int timeout_ms = 5000; //Reduced from 1200 same functionality but cpu usage reduced by ~20%, any higher yield no sig results + const int timeout_ms = 1200; // while the incoming events thread run... while ((ctx->flags & INPUT_CTX_FLAGS_READ_TERMINATED) == 0) { @@ -668,12 +667,6 @@ void *input_dev_thread_func(void *ptr) { } input_udev(in_dev, &ctx); - - // free memory - for (int h = 0; h < MAX_MESSAGES_IN_FLIGHT; ++h) { - free(ctx.messages[h].data.event.ev); - ctx.messages[h].data.event.ev_size = 0; - } } else if (in_dev->dev_type == input_dev_type_iio) { // prepare space and empty messages for (int h = 0; h < MAX_MESSAGES_IN_FLIGHT; ++h) { diff --git a/output_dev.c b/output_dev.c index 8876aaf..8da4394 100644 --- a/output_dev.c +++ b/output_dev.c @@ -951,7 +951,7 @@ void *output_dev_thread_func(void *ptr) { for (;;) { void *raw_ev; - const int pop_res = queue_pop_timeout(&out_dev->logic->input_queue, &raw_ev, 1800); + const int pop_res = queue_pop_timeout(&out_dev->logic->input_queue, &raw_ev, 1000); if (pop_res == 0) { message_t *const msg = (message_t*)raw_ev; handle_msg(out_dev, msg);