Expose API to control rate and max prior attempts of collect_a_little
authorJonathan Chambers <joncham@gmail.com>
Tue, 10 Apr 2018 17:02:57 +0000 (13:02 -0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 24 Apr 2018 07:42:19 +0000 (10:42 +0300)
commitf0d18c37304e89ae18c745ba7ff1c930482ede8c
tree5a24c91f41cc40fe930075d0ae3c5066ba2d93e6
parent14a61e98a81998d976b5119d8881de4444e93832
Expose API to control rate and max prior attempts of collect_a_little
(a cherry-pick of commit d897344 from 'unity-release-7_4-incremental')

* alloc.c (GC_RATE): Update comment.
* alloc.c (GC_rate): New STATIC variable (initialized to GC_RATE).
* alloc.c (GC_set_rate, GC_get_rate, GC_set_max_prior_attempts,
GC_get_max_prior_attempts): New API function definition.
* alloc.c (max_prior_attempts): New static variable (initialized to
MAX_PRIOR_ATTEMPTS).
* alloc.c (GC_collect_a_little_inner): Replace GC_RATE to GC_rate;
declare max_deficit local variable and compute GC_rate*n once (per
a function call); replace MAX_PRIOR_ATTEMPTS to max_prior_attempts.
* include/gc.h (GC_set_rate, GC_get_rate, GC_set_max_prior_attempts,
GC_get_max_prior_attempts): New API function declaration.
* tests/test.c [GC_PTHREADS] (main): Call GC_set_rate, GC_get_rate,
GC_set_max_prior_attempts, GC_get_max_prior_attempts.
alloc.c
include/gc.h
tests/test.c