about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--blocking.arc.t25
-rw-r--r--mu.arc6
2 files changed, 27 insertions, 4 deletions
diff --git a/blocking.arc.t b/blocking.arc.t
new file mode 100644
index 00000000..c20e38e8
--- /dev/null
+++ b/blocking.arc.t
@@ -0,0 +1,25 @@
+(selective-load "mu.arc" section-level)
+
+(reset)
+(new-trace "blocking-example")
+(add-code
+  '((function reader [
+      (default-space:space-address <- new space:literal 30:literal/capacity)
+      (x:tagged-value 1:channel-address/space:global <- read 1:channel-address/space:global)
+     ])
+    (function main [
+      (default-space:space-address <- new space:literal 30:literal/capacity)
+      (1:channel-address <- init-channel 3:literal)
+      (2:integer/routine <- fork reader:fn default-space:space-address/globals 50:literal/limit)
+      ; write nothing to the channel
+;?       (sleep until-routine-done:literal 2:integer/routine)
+     ])))
+;? (= dump-trace* (obj whitelist '("schedule" "run")))
+(run 'main)
+;? (prn "completed:")
+;? (each r completed-routines*
+;?   (prn " " r))
+(if (ran-to-completion 'reader)
+  (prn "F - reader waits for input"))
+
+(reset)
diff --git a/mu.arc b/mu.arc
index 2b612941..9afccfef 100644
--- a/mu.arc
+++ b/mu.arc
@@ -1381,10 +1381,8 @@
 (def ran-to-completion (f)
   ; if a routine calling f ran to completion there'll be no sign of it in any
   ; completed call-stacks.
-  ; hack: only checks top call in each call stack
-  (no (find [aand stack._
-                  (is f top._!fn-name)]
-            completed-routines*)))
+  (~find [some [is f _!fn-name] stack._]
+         completed-routines*))
 
 ;; system software
 ; create once, load before every test
n174'>174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296