From 3a623002694f46a1d5dcf8460b4072f3ff1c00fe Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sat, 19 Aug 2017 15:54:03 +0000 Subject: [PATCH] fixed a comparison bug in sift_down_sem_heap() for semaphore heap management --- moo/lib/exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/moo/lib/exec.c b/moo/lib/exec.c index 0fe08ac..affb3a6 100644 --- a/moo/lib/exec.c +++ b/moo/lib/exec.c @@ -796,7 +796,7 @@ static void sift_down_sem_heap (moo_t* moo, moo_ooi_t index) left = SEM_HEAP_LEFT(index); right = SEM_HEAP_RIGHT(index); - if (right < moo->sem_heap_count && SEM_HEAP_EARLIER_THAN(moo, moo->sem_heap[left], moo->sem_heap[right])) + if (right < moo->sem_heap_count && SEM_HEAP_EARLIER_THAN(moo, moo->sem_heap[right], moo->sem_heap[left])) { child = right; } @@ -809,7 +809,7 @@ static void sift_down_sem_heap (moo_t* moo, moo_ooi_t index) if (SEM_HEAP_EARLIER_THAN(moo, sem, chisem)) break; chisem->heap_index = MOO_SMOOI_TO_OOP(index); - moo->sem_heap[index ] = chisem; + moo->sem_heap[index] = chisem; index = child; }