Forgot to lock for new_mutators

This commit is contained in:
Justin Ethier 2019-06-11 15:54:12 -04:00
parent f3d9228d5e
commit cdbf81c56a
2 changed files with 5 additions and 1 deletions

2
gc.c
View file

@ -273,8 +273,10 @@ void gc_add_mutator(gc_thread_data * thd)
primordial_thread = thd;
} else {
// At this point the mutator is running, so remove it from the new list
pthread_mutex_lock(&mutators_lock);
ck_array_remove(&new_mutators, (void *)thd);
ck_array_commit(&new_mutators);
pthread_mutex_unlock(&mutators_lock);
}
}

View file

@ -11,7 +11,7 @@
(define (sum-loop n)
(mutex-lock! m)
(set! *sum* (+ *sum* 1))
(set! *sum* (make-shared (+ *sum* 1)))
(mutex-unlock! m)
;(swap! *sum* + 1)
(if (zero? n)
@ -42,5 +42,7 @@
(thread-join! t5)
(thread-join! t6)
(display "main thread done, sum = ")
(mutex-lock! m)
(display *sum*)
(newline)
(mutex-unlock! m)