[sgen] Make sure workers process jobs only if they are running (#4974)
authorVlad Brezae <brezaevlad@gmail.com>
Wed, 7 Jun 2017 09:58:54 +0000 (12:58 +0300)
committerGitHub <noreply@github.com>
Wed, 7 Jun 2017 09:58:54 +0000 (12:58 +0300)
This simplifies logic and prevents serial context being used by multiple workers at the same time.

mono/sgen/sgen-workers.c

index 82d637d2b2674c12cca0fb0331d4966fe8085a6f..8d3252eb186d6879d8028a80f42acce32ba7d8ca 100644 (file)
@@ -314,7 +314,7 @@ should_work_func (void *data_untyped)
        WorkerData *data = (WorkerData*)data_untyped;
        int current_worker = (int) (data - workers_data);
 
-       return started && current_worker < active_workers_num;
+       return started && current_worker < active_workers_num && state_is_working_or_enqueued (data->state);
 }
 
 static void