summaryrefslogtreecommitdiff
path: root/tests/test_hashtab_thrash.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2013-08-14 18:10:08 +0000
committerJoshua Colp <jcolp@digium.com>2013-08-14 18:10:08 +0000
commita0aa754a394ab3c71e2289458042281974706d8c (patch)
tree38e0e1f5e06597b5f19f8f7d0ae6646ba9f2ab12 /tests/test_hashtab_thrash.c
parent29945cf23856dcd559fff8f581e94a5c8aac5492 (diff)
Tweak test_hashtab_thrash test to allow the critical threads to execute.
Depending on certain conditions it was possible for the hashtab counting thread to starve other threads, preventing them from executing in the expected fashion. This change adds a sleep to allow the others to do what they need to do. While this doesn't thrash the hashtab as much as previously, it at least works. (closes issue ASTERISK-22276) Reported by: Matt Jordan ........ Merged revisions 396619 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 396620 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396621 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'tests/test_hashtab_thrash.c')
-rw-r--r--tests/test_hashtab_thrash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test_hashtab_thrash.c b/tests/test_hashtab_thrash.c
index 931cc4318..619090afa 100644
--- a/tests/test_hashtab_thrash.c
+++ b/tests/test_hashtab_thrash.c
@@ -208,7 +208,7 @@ static void *hash_test_count(void *d)
if (last_count == count) {
/* Allow other threads to run. */
- sched_yield();
+ usleep(1);
} else if (last_count > count) {
/* Make sure the hashtable never shrinks */
return "hashtab unexpectedly shrank";