Fork: Difference between revisions
Content added Content deleted
m (→{{header|J}}) |
m (→{{header|J}}) |
||
Line 472: | Line 472: | ||
=={{header|J}}== |
=={{header|J}}== |
||
This example works by calling fork in a shared object library of Ubuntu 14.04.1 LTS . |
This example works by calling fork in a shared object library of Ubuntu 14.04.1 LTS . The verb given to adverb Fork evaluates in the child process. |
||
<lang J> |
<lang J> |
||
load'dll' |
load'dll' |
||
Fork =: @.( |
Fork =: (('Error'"_)`('Parent'"_)`)(@.([: >: [: * '/lib/x86_64-linux-gnu/libc-2.19.so __fork > x' cd [: i. 0&[))</lang> |
||
⚫ | |||
</lang> |
|||
⚫ | |||
<pre> |
<pre> |
||
NB. interactive session demonstrating Fork |
NB. interactive session demonstrating Fork |
||
Line 483: | Line 482: | ||
SLEEP =: 3 |
SLEEP =: 3 |
||
sleep =: SLEEP Time |
sleep =: SLEEP Time |
||
([:exit 0:[:smoutput'child'[sleep)Fork 50 NB. start the child |
|||
parent |
parent |
||
i._2 3 4 NB. interactive computations continue in the parent process |
i._2 3 4 NB. interactive computations continue in the parent process |