Skip to content
Snippets Groups Projects
Commit e3e53866 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Kirill Yukhin
Browse files

gc: use wide integer for schedule counting


Currently we use unsined int for "cleanup" schedule
counting, this is safe while this routine is not
called too often. Still there is a chance to hit
a number wrap on code modification because there
is no strict rule on how to use this garbage collector.
Lets use wide integers instead, we have only one gc
instance and such approach eliminates potential problems
in future (actually this should had been done from the
beginning since the current gc code flow developed
without wrapping in mind).

In-scope-of #5806

Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 985548e4
No related branches found
No related tags found
No related merge requests found
......@@ -239,7 +239,7 @@ gc_cleanup_fiber_f(va_list ap)
{
(void)ap;
while (!fiber_is_cancelled()) {
int delta = gc.cleanup_scheduled - gc.cleanup_completed;
int64_t delta = gc.cleanup_scheduled - gc.cleanup_completed;
if (delta == 0) {
/* No pending garbage collection. */
fiber_sleep(TIMEOUT_INFINITY);
......@@ -278,7 +278,7 @@ gc_schedule_cleanup(void)
static void
gc_wait_cleanup(void)
{
unsigned scheduled = gc.cleanup_scheduled;
int64_t scheduled = gc.cleanup_scheduled;
while (gc.cleanup_completed < scheduled)
fiber_cond_wait(&gc.cleanup_cond);
}
......
......@@ -146,7 +146,7 @@ struct gc_state {
* sleep until @completed reaches the value of @scheduled
* taken at that moment of time.
*/
unsigned cleanup_completed, cleanup_scheduled;
int64_t cleanup_completed, cleanup_scheduled;
/**
* Set if there's a fiber making a checkpoint right now.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment