From cea445321a1fe6860db0f7ca13fec3b7c58acd2b Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 17 Nov 2025 01:30:58 +0000 Subject: [PATCH] Refined the TODOs --- README.org | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index 2ab1989..59c943f 100644 --- a/README.org +++ b/README.org @@ -28,12 +28,28 @@ implementation. Might need to study my current implementation to see if it could be done better. -2025-11-17: Notes: -- Mutex on the queue [[file:src/main.cpp::std::queue - iteration_queue;][the queue]] and the allocator will be necessary. -- Perhaps we could do two mutexes, one per structure? -- We'd need to lock for [[file:src/numerics.cpp::std::tuple iterate(std::queue &queue,][iterate]] +*** TODO Formalise state structure (separate drawing functions) +Make a dedicated header and fit the necessary functions to our state +structure: [[file:src/main.cpp::struct State][state structure]]. + +We need this in order so that we can get multithreading (using mutexes +on the actual state itself) working. + +A good working name would be ~cw_state~. + +We could then have a separate structure for the drawing context +(~cw_draw~) which can update itself by reading the ~cw_state~. +*** TODO Setup a queue and allocator mutex on state +We need one for the queue so we can make clean pushes and pops, and +one for the allocator to ensure we're not messing up our indices in +the nodes. + +We could just set these up in the state structure itself to make +lookup easier. +*** TODO Make iterate use the state structure and mutexes +[[file:src/numerics.cpp::std::tuple +iterate(std::queue &queue,]] + - Locking scheme could be: - Lock queue when popping a value as root, then unlock. - Leave queue and allocator unlocked while getting root/left/right @@ -44,6 +60,10 @@ done better. - Queue lock when pushing the left and right fractions for further processing, then unlock - Unlock all when returning relevant values + +I think this scheme minimises the any mutex is locked to just the bare +minimum, ensuring other threads can get in on the action. +*** TODO Setup a thread pool utilising state and iterate ** TODO Prettify code base It's a big blob of code currently in the graphics portion. Not very pretty but it gets the job done. Try modularisation.