Revert "CPU usage optimization + fixed a non-existing leak (program cannot exit that function)"
This reverts commit 84452857c0.
This commit is contained in:
parent
84452857c0
commit
dd7af4dd22
2 changed files with 2 additions and 9 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue