Edit description of concurrency model

This commit is contained in:
Petar Kapriš 2025-10-24 09:52:36 +02:00
parent 8e5f5a38d9
commit eef91c0cf7

View file

@ -30,15 +30,24 @@ struct threadInfo {
/*
* Concurrency model explained:
* One reader thread (the GUI thread) of the pixel buffer, along with many
* writers, who split the work of rendering roughly equally. The writers don't
* do any work until the pixel map which they are meant to work on is marked as
* available.
* 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
* are meant to work on is marked as available, and they are all singalled to start
* drawing.
*
* Once it is marked as such, this means that the planeView structure is well
* defined, that pixmap points to a memory region, which is allocated with
* enough memory for the plain view, and they can all start writing without an
* issue.
*
* Once they are all finished, the last thread to exit the drawing function will signal
* the main thread to "blit" the finished image to the screen.
*
* If any kind of change by the user happens (window resize, panning/zooming (TODO: not
* implemented yet), the main thread will cause all worker threads to stop working, if
* they haven't already (they occassionally poll while drawing to see if they should
* stop). Once they've all stopped, the main thread will update and replace the drawing
* area, and naturally, signal them to start drawing again.
*/
pthread_mutex_t pixmapMutex;