diff --git a/visor.c b/visor.c index 3bf4951..c5527b1 100644 --- a/visor.c +++ b/visor.c @@ -119,7 +119,18 @@ void draw_mandelbrot(struct threadInfo *info) pixmap[4*(i*w + j) + 0] = b; } } + pthread_mutex_lock(&pixmapMutex); info->complete = true; + bool allWritersComplete = true; + for (int32_t i = 0; i < thread_count; i++) { + if (!threads[i].complete) { + allWritersComplete = false; + } + } + if (allWritersComplete) { + cairo_surface_mark_dirty(surface); + } + pthread_mutex_unlock(&pixmapMutex); } #define MAX_ITERATION 1000