Skip to content

Instantly share code, notes, and snippets.

@fuxoft
Created June 20, 2024 13:46
Show Gist options
  • Save fuxoft/52da8949edba4961c059c18014d90cc3 to your computer and use it in GitHub Desktop.
Save fuxoft/52da8949edba4961c059c18014d90cc3 to your computer and use it in GitHub Desktop.
PicoLisp IPC counter
#!/usr/bin/picolisp /usr/lib/picolisp/lib.l
(setq Uniq
(pipe
(prog
(zero X)
(loop
(pr (list "unique counter" (inc 'X))) ) ) ) )
(if (fork)
(for N 3 (wait 1000) (println "parent step #" N (in Uniq (rd))))
(for N 4 (wait 700) (println "child step #" N (in Uniq (rd)))))
(bye)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment