On 24.07.2018 21:32, Raul Miller wrote:
On Tue, Jul 24, 2018 at 2:10 PM Sergey Kamenev <jsof...@inetstar.ru> wrote:
I working under Gentoo linux based distributive (Calculate Linux)
I have not built any working examples of calling a j sub-process under linux.
Can you point me at something illustrative and simple, but complete?
I'm forking j process by using shared c library. It's no clear. It would be
better if J has received support for linux *fork* function.
#!/usr/bin/env jc
fork =: adverb : 0
pid =: > '/lib/libc.so.6 __fork x' cd ''
if. pid < 0 do.
echo 'Error'
0:
elseif. pid > 0 do.
echo 'Child'
x
elseif. do.
echo 'Parent'
0:
end.
)
child_work =: monad : 0
NB. Sleep 4 second
6!:3 ]4
echo i.5
1
)
(exit @ 0: @ child_work) fork ''
echo 'Return to parent'
exit ''
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm