Better ScriptFollowsDeferExec ?
1 post
• Page 1 of 1
Better ScriptFollowsDeferExec ?
We have the following function:
it is used to run in the background some code of a long callback without waiting for the result. For example:
The idea is to keep the code of the long callback all at the same place to make it easier to troubleshoot while at the same time being able to send part of it to another thread to finish executing and allowing the callback to terminate.
Is there a better way of doing the same thing (token ? isolates ?)
Thanks in advance
P.S.: We are using '⍝∇' as our delimiter because we are erasing all the lines beginning with '⍝' in our production (run time) code.
ScriptFollowsDeferExec;dtlb;lines
⍝ Treat the following commented lines as a function to be executed on another thread
⍝ Lines beginning with ⍝∇ are kept
⍝ Lines beginning with ⍝∇⍝ are stripped out (comments)
⍝ Make global the variables you need to pass.
⍝ Modified version for the following WS default: (⎕IO ⎕ML) ← 1 3
dtlb←{⍵{((∨\⍵)∧⌽∨\⌽⍵)/⍺}' '≠⍵}
lines←{{'⍝'=↑⍵:'' ⋄ ' ',dtlb ⍵}¨2↓¨⍵/⍨∧\(⊂'⍝∇')≡¨2↑¨⍵}dtlb¨(1+2⊃⎕LC)↓⎕NR 2⊃⎕XSI
(⎕IO⊃⎕RSI).⎕FX(⊂'RunBackgroundDeferExec'),lines
(⎕IO⊃⎕RSI){⍺.RunBackgroundDeferExec}&0
it is used to run in the background some code of a long callback without waiting for the result. For example:
∇LongCallback[⎕]∇
[0] LongCallback
[1]
[2] some code
[3] more code here
[4]
[5] ScriptFollowsDeferExec
[6] ⍝∇ defer line of code
[7] ⍝∇ more defer line of code
The idea is to keep the code of the long callback all at the same place to make it easier to troubleshoot while at the same time being able to send part of it to another thread to finish executing and allowing the callback to terminate.
Is there a better way of doing the same thing (token ? isolates ?)
Thanks in advance
P.S.: We are using '⍝∇' as our delimiter because we are erasing all the lines beginning with '⍝' in our production (run time) code.
-
PGilbert - Posts: 436
- Joined: Sun Dec 13, 2009 8:46 pm
- Location: Montréal, Québec, Canada
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group