summaryrefslogtreecommitdiff
path: root/runtime/remote.apl
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/remote.apl')
-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
}⍬
⍺∇⍵