]> git.ipfire.org Git - thirdparty/asterisk.git/commit
tests/test_sorcery_memory_cache_thrash: Improve termination process. 18/2218/2
authorJoshua Colp <jcolp@digium.com>
Tue, 9 Feb 2016 13:11:36 +0000 (09:11 -0400)
committerJoshua Colp <jcolp@digium.com>
Tue, 9 Feb 2016 17:25:01 +0000 (11:25 -0600)
commite40fddbeb5dbc4f557a6c215eb211091f2fe3161
tree6811c1ec7109caf5fc285402f61c642340364dd6
parent7e4378770d6c459702e07ecf01c9fc6e1400c207
tests/test_sorcery_memory_cache_thrash: Improve termination process.

When terminating the threads thrashing a sorcery memory cache each
would be told to stop and then we would wait on them. During at
least one thrashing test this was problematic due to the specific
usage pattern in use. It would take some time for termination of the
thread to occur.

This would occur due to contention between the threads retrieving
and the threads updating the cache. As the retrieving threads are
given priority it may be some time before the updating threads
are able to proceed.

This change makes it so all threads are told to stop and then each
are joined to ensure they stop. This way all the threads should
stop at around the same time instead of waiting for one to stop,
the next to stop, then the next, and so on. As a result of this
the execution time for each thrash test is much closer to their
expected value than previously seen as well.

Change-Id: I04a53470b0ea4170b8819180b0bd7475f3642827
tests/test_sorcery_memory_cache_thrash.c