Dyalog / dyalog-jupyter-kernel

A Jupyter kernel for Dyalog APL
https://dyalog.github.io/dyalog-jupyter-kernel/
MIT License
64 stars 20 forks source link

Kernel does not synchronise threads #81

Closed xpqz closed 10 months ago

xpqz commented 2 years ago

Executing the following in a cell does not produce the expected result:

{⎕←'Started waiting',⍵,'s' ⋄ ⎕←'Elapsed:',(⎕DL ⍵),'s'}&¨0.6 1.2 1.8 ⋄ ⎕DL 1 ⋄ ⎕←'    Unrelated stuff'

In order for it to work, you need to sync explicitly:

 ⎕TSYNC {⎕←'Started waiting',⍵,'s' ⋄ ⎕←'Elapsed:',(⎕DL ⍵),'s'}&¨0.6 1.2 1.8 ⋄ ⎕DL 1 ⋄ ⎕←'    Unrelated stuff'

My expectation was that a cell's execution should await any threads, to align with the behaviour of the session.