Replace mentions of "writer" threads with "worker" threads

This commit is contained in:
Petar Kapriš 2025-10-24 10:20:20 +02:00
parent b2249f6639
commit b5b2d09d43

View file

@ -31,7 +31,7 @@ struct threadInfo {
/*
* Concurrency model explained:
* One main thread, along with many workers in a thread pool, who split the work of
* rendering roughly equally. The writers don't do any work until the pixel map which they
* rendering roughly equally. The workers don't do any work until the pixel map which they
* are meant to work on is marked as available, and they are all singalled to start
* drawing.
*
@ -84,7 +84,7 @@ void color_lookup(int *r, int *g, int *b, double mu);
// worker code
gboolean queue_redraw_plane(void *arg);
void *writer_thread(void *arg)
void *worker_thread(void *arg)
{
struct threadInfo *info = arg;
while (true) {
@ -121,7 +121,7 @@ void draw_mandelbrot(struct threadInfo *info)
pthread_mutex_unlock(&pixmapMutex);
return;
// after this, the thread will again enter the
// loop in the writer_thread function, and
// loop in the worker_thread function, and
// enter a wait state
}
pthread_mutex_unlock(&pixmapMutex);
@ -259,7 +259,7 @@ int main(int argc, char **argv)
// integer, if the thread fails to start, it will simply be
// overwritten by the same value in the next run of the loop
pthread_t id;
if (pthread_create(&id, NULL, &writer_thread, &threads[count])) {
if (pthread_create(&id, NULL, &worker_thread, &threads[count])) {
pthread_detach(id);
fprintf(stderr, "Failed to create thread %d\n", i);
continue;