about summary refs log tree commit diff stats
path: root/html/088file.mu.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-10-29 21:23:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-10-29 21:23:56 -0700
commit8bafc90dfda6cd170343ad1d7351d418f38189ae (patch)
tree97c8fe5b5ebe9b7b40ca063dba4e3c9d6231e924 /html/088file.mu.html
parentef69c56c82e85e83014605f501110697d81bcdc1 (diff)
downloadmu-8bafc90dfda6cd170343ad1d7351d418f38189ae.tar.gz
3609
Diffstat (limited to 'html/088file.mu.html')
-rw-r--r--html/088file.mu.html6
1 files changed, 5 insertions, 1 deletions
diff --git a/html/088file.mu.html b/html/088file.mu.html
index 26fa0c7c..46d9363a 100644
--- a/html/088file.mu.html
+++ b/html/088file.mu.html
@@ -35,6 +35,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
 <span class="Comment"># are thus easier to test.</span>
 
 <span class="muData">container</span> resources [
+  lock:bool
   data:&amp;:@:resource
 ]
 
@@ -117,7 +118,6 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
   <span class="Delimiter">{</span>
     <span class="muControl">break-unless</span> resources
     <span class="Comment"># fake file system</span>
-    <span class="Comment"># beware: doesn't support multiple concurrent writes yet</span>
     routine-id <span class="Special">&lt;-</span> start-running transmit-to-fake-file resources, filename, source
     <span class="muControl">reply</span>
   <span class="Delimiter">}</span>
@@ -142,6 +142,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
 <span class="muRecipe">def</span> transmit-to-fake-file resources:&amp;:resources, filename:text, source:&amp;:source:char<span class="muRecipe"> -&gt; </span>resources:&amp;:resources, source:&amp;:source:char [
   <span class="Constant">local-scope</span>
   <span class="Constant">load-ingredients</span>
+  lock:location <span class="Special">&lt;-</span> get-location *resources, <span class="Constant">lock:offset</span>
+  wait-for-reset-then-set lock
   <span class="Comment"># compute new file contents</span>
   buf:&amp;:buffer <span class="Special">&lt;-</span> new-buffer<span class="Constant"> 30</span>
   <span class="Delimiter">{</span>
@@ -166,6 +168,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
     found?:bool <span class="Special">&lt;-</span> equal filename, curr-filename
     <span class="muControl">loop-unless</span> found?
     put-index *data, i, new-resource
+    reset lock
     <span class="muControl">reply</span>
   <span class="Delimiter">}</span>
   <span class="Comment"># if file didn't already exist, make room for it</span>
@@ -182,6 +185,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color
   <span class="Delimiter">}</span>
   <span class="Comment"># write new file</span>
   put-index *new-data, len, new-resource
+  reset lock
 ]
 </pre>
 </body>