Explorar o código

fixed race condition in gc mark threads

Nicolas Cannasse %!s(int64=2) %!d(string=hai) anos
pai
achega
6e754cce62
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/gc.c

+ 2 - 2
src/gc.c

@@ -895,8 +895,8 @@ static void mark_thread_main( void *param ) {
 	while( true ) {
 		hl_semaphore_acquire(inf->ready);
 		inf->mark_count += gc_flush_mark(&inf->stack);
-		hl_semaphore_release(mark_threads_done);
-		atomic_bit_unset(&mark_threads_active, 1 << index);
+		while( !atomic_bit_unset(&mark_threads_active, 1 << index) ) {};
+		if( mark_threads_active == 0 ) hl_semaphore_release(mark_threads_done);
 	}
 }