Fork: Difference between revisions
Content added Content deleted
m (→{{header|Sidef}}: fix example) |
(Add BaCon) |
||
Line 68: | Line 68: | ||
Run, %A_AhkPath% "%A_ScriptFullPath%" |
Run, %A_AhkPath% "%A_ScriptFullPath%" |
||
MsgBox, 0, Fork, Stop this process.</lang> |
MsgBox, 0, Fork, Stop this process.</lang> |
||
=={{header|BaCon}}== |
|||
<lang freebasic>' Fork |
|||
pid = FORK |
|||
IF pid = 0 THEN |
|||
PRINT "I am the child, my PID is:", MYPID |
|||
ENDFORK |
|||
ELIF pid > 0 THEN |
|||
PRINT "I am the parent, pid of child:", pid |
|||
REPEAT |
|||
PRINT "Waiting for child to exit" |
|||
SLEEP 50 |
|||
UNTIL REAP(pid) |
|||
ELSE |
|||
PRINT "Error in fork" |
|||
ENDIF</lang> |
|||
{{out}} |
|||
<pre>prompt$ bacon fork.bac |
|||
Converting 'fork.bac'... done, 14 lines were processed in 0.004 seconds. |
|||
Compiling 'fork.bac'... cc -c fork.bac.c |
|||
cc -o fork fork.bac.o -lbacon -lm |
|||
Done, program 'fork' ready. |
|||
prompt$ ./fork |
|||
I am the parent, pid of child:12733 |
|||
Waiting for child to exit |
|||
I am the child, my PID is:12733</pre> |
|||
=={{header|C}}== |
=={{header|C}}== |