summaryrefslogtreecommitdiff
path: root/docs/application/shared.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/application/shared.md')
-rw-r--r--docs/application/shared.md15
1 files changed, 14 insertions, 1 deletions
diff --git a/docs/application/shared.md b/docs/application/shared.md
index bed94d2..b2760c5 100644
--- a/docs/application/shared.md
+++ b/docs/application/shared.md
@@ -9,7 +9,20 @@ typedef struct _kpl_shared {
KPL_SLAB_HEADER(_kpl_shared);
void *data;
kpl_atomic_queue queue;
- _Atomic bool mutating;
+ _Atomic uint32_t lock;
bool mark;
} kpl_shared;
```
+
+## Mutating
+
+1. Before adding to the `queue` do `value = lock++`
+2. Add to the queue
+3. If `value` is `0` the thread does an async schedule of the mutator task, otherwise the thread moves on
+
+### Mutator Task
+
+1. Get task from `queue` and run task
+2. After task completion, do `value = --lock`, stop if `value` is `0`, otherwise repeat
+
+## Garbage Collection