summaryrefslogtreecommitdiff
path: root/shared_counter.kpl
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-06-17 19:48:14 -0400
committernodist <kevin.comas.git@gmail.com>2026-06-17 19:48:14 -0400
commit4f132dc241f0e9fd0babd34ebf1767e4916fac7c (patch)
treede312b52ff9c9bbcb46cc19cb4e0dc6e63a87113 /shared_counter.kpl
parente5f1630c5ab4c942d3287f92cbb71f34267dc747 (diff)
thread id op
Diffstat (limited to 'shared_counter.kpl')
-rw-r--r--shared_counter.kpl8
1 files changed, 5 insertions, 3 deletions
diff --git a/shared_counter.kpl b/shared_counter.kpl
index d5d9efa..f9ae293 100644
--- a/shared_counter.kpl
+++ b/shared_counter.kpl
@@ -4,13 +4,13 @@
counter : %shared 0
inc_dec : ([amount]
- header : %const `format "WHITE#Counter:# "
+ header : "#BOLD#Thread: %#, #WHITE#Counter:# " `format `thread_id
body : ^ counter {[c]
c +: amount
? {
amount = 1 { "#GREEN#%#" `format c }
amount = -1 { "#RED#%#" `format c }
- { "INVALID" }
+ { "#UNDERLINE#INVALID#" }
}
}
`log ,(header; body; "\n")
@@ -26,7 +26,7 @@ batch : %const 100
runner : ([fn]
total : actions
@ total {
- `log "#BOLD#WHITE#Batch: #CYAN#% #MAGENTA#%#\n" `format (fn; total)
+ `log "#WHITE#Batch: #CYAN#% #MAGENTA#%#\n" `format (fn; total)
v : Vector[`async_type fn] $ ()
@ 1 .. batch { v `push `async fn }
@ v {[x] `await x }
@@ -37,6 +37,8 @@ runner : ([fn]
i : runner `async inc
d : runner `async dec
+`log `format "#YELLOW#SLEEPING...#\n"
+
`use "time" [Seconds]
`use "sys" [sleep]