summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorglenda <glenda@cirno>2022-10-05 13:29:07 +0000
committerglenda <glenda@cirno>2022-10-05 13:29:07 +0000
commit73b3078cb551f03d959e8beb1adc6804efb13579 (patch)
tree3fd8b9ea531350031f9a7489286fcf801db9a30b /runtime
parent65fc8018457f595ec9800946914f37133dae0667 (diff)
Update demos and remote.apl
Diffstat (limited to 'runtime')
-rw-r--r--runtime/remote.apl12
1 files changed, 4 insertions, 8 deletions
diff --git a/runtime/remote.apl b/runtime/remote.apl
index f696a15..7733783 100644
--- a/runtime/remote.apl
+++ b/runtime/remote.apl
@@ -1,11 +1,9 @@
REMOTE←{
fd←⎕PIPE ⍵
- out←{
- msg←{1(2⊃⍵)}⍇⍬
- raw←0 ⎕SERIAL msg
+ output←{
+ raw←0 ⎕SERIAL ⍵
len←(4⍴255)⊤≢raw
_←fd ⎕WRITE len,raw
- ∇⍵
}
in←{
m←1 ⎕serial fd ⎕read (4⍴255)⊥fd ⎕read 4
@@ -13,13 +11,11 @@ REMOTE←{
∇⍵
}
remote←{
- 0≡≢⍵: ⍺∇out&'remote out'⊢⎕self ⍝ Spawn out thread
- 1≡≢⍵: ⍺∇⍵,in&'remote in'⊢⎕self ⍝ Spawn in thread
- (outid inid)←⍵
+ ⍬≡⍵: ⍺∇in&'remote in'⊢⎕self ⍝ Spawn 'in' thread
master←⍺
(from msg)←{1 ⍵}⍇⍬
_←{
- from≡master: msg⍈outid
+ from≡master: output msg
from≢master: msg⍈master
}⍬
⍺∇⍵