Skip to content

Commit

Permalink
Implement heap based timer list (#439)
Browse files Browse the repository at this point in the history
* tlist: Add heap based implementation of timer list

Previous timer was sorted list implementation of priority queue
and very slow when number of timers increased. This is mostly
not a problem because usually only few timers are used.
But for application where bigger number of timers are needed
it may become problem.

Solution is to use binary heap based priority queue which is much
faster.

API is unchanged, just timerlist_destroy is added which should be called
to free heap array. This function also destroys mutex (omitted when
mutex was added).

* tests: Fix check loop mt test

test_th was accesed both by main thread and loop_timer thread resulting in
failure. Fix is to access test_tht in loop_timer thread.

Speed test is adding only 10000 items so it is reasonable
fast even with sorted linked list implementation.

Signed-off-by: Jan Friesse <[email protected]>
  • Loading branch information
jfriesse authored Mar 18, 2021
1 parent 9e1e3a2 commit 48fff5e
Show file tree
Hide file tree
Showing 5 changed files with 606 additions and 44 deletions.
Loading

0 comments on commit 48fff5e

Please sign in to comment.