diff options
-rw-r--r-- | docs/threading-plan.txt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/threading-plan.txt b/docs/threading-plan.txt new file mode 100644 index 0000000..794d60f --- /dev/null +++ b/docs/threading-plan.txt | |||
@@ -0,0 +1,28 @@ | |||
1 | It looks like the following changes will have to happen in order to allow build | ||
2 | to bu truly multi-threaded. We can't proceed like I originally thought, the | ||
3 | entire system is build-script driven, including the profiles that do the actual | ||
4 | building. | ||
5 | |||
6 | 1. Context needs to be broken apart into everything it currently has except | ||
7 | the ScopeStack, and the ScopeStack. The initial ScopeStack (the root level) | ||
8 | will be built before the program goes multi-thraeded, then it will be copied | ||
9 | into each thread so they all start with the same global state. | ||
10 | Targets will still be built the same way, so we won't have to worry about | ||
11 | targets' global variable overrides. | ||
12 | 2. Instead of each target actually processing it's complete list of dependancies | ||
13 | when it's processed, it should create a queue of them. This may well be the | ||
14 | biggest change, but it still should be fairly doable. We'll still process | ||
15 | them in the same order, which will make things pretty easy. | ||
16 | That queue will be global, and will be what feeds the thread dispatcher. | ||
17 | 3. A new thread handler and thread class needs to be created. The threads will | ||
18 | dequeue targets from the target queue and process them provided all | ||
19 | prerequisites have been completed. We can do this a few ways, but I think | ||
20 | a simple loop will suffice. | ||
21 | Loop steps: | ||
22 | 1. Check all deps on target, if completed, then execute, otherwise: | ||
23 | 2. Wait on condition that is triggered every time a target is completed. | ||
24 | 3. Go back to 1 | ||
25 | 4. View needs to be made completely thread-safe, I'm thinking maybe through a | ||
26 | View system middle layer handler in order to keep the specific View code | ||
27 | pretty simple. | ||
28 | |||