Fork: Difference between revisions

17 bytes added ,  4 years ago
Rename Perl 6 -> Raku, alphabetize, minor clean-up
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 63:
This is the original process
</pre>
 
=={{header|AutoHotkey}}==
<lang autohotkey>MsgBox, 4, Fork, Start another process?
Line 170 ⟶ 171:
mySubroutine3: mySubroutine1 has been run
</pre>
 
=={{header|C}}==
{{libheader|POSIX}}<lang c>#include <stdio.h>
Line 195 ⟶ 197:
child process: done
child 3604 finished</lang>
 
=={{header|C#|C sharp|C#}}==
<lang csharp>using System;
using System.Threading;
 
namespace Fork {
class Program {
static void Fork() {
Console.WriteLine("Spawned Thread");
}
 
static void Main(string[] args) {
Thread t = new Thread(new ThreadStart(Fork));
t.Start();
 
Console.WriteLine("Main Thread");
t.Join();
 
Console.ReadLine();
}
}
}</lang>
 
=={{header|C++}}==
Line 221 ⟶ 245:
 
return 0;
}</lang>
 
=={{header|C#|C sharp}}==
<lang csharp>using System;
using System.Threading;
 
namespace Fork {
class Program {
static void Fork() {
Console.WriteLine("Spawned Thread");
}
 
static void Main(string[] args) {
Thread t = new Thread(new ThreadStart(Fork));
t.Start();
 
Console.WriteLine("Main Thread");
t.Join();
 
Console.ReadLine();
}
}
}</lang>
 
Line 815 ⟶ 817:
Parent again.
</pre>
 
 
=={{header|Kotlin}}==
Line 1,160 ⟶ 1,161:
}
};</lang>
 
=={{header|Perl 6}}==
{{Works with|rakudo|2016.06}}
<lang perl6>use NativeCall;
sub fork() returns int32 is native { ... }
 
if fork() -> $pid {
print "I am the proud parent of $pid.\n";
else {
print "I am a child. Have you seen my mommy?\n";
}</lang>
{{out}}
<pre>I am the proud parent of 17691.
I am a child. Have you seen my mommy?</pre>
 
=={{header|Phix}}==
Line 1,270 ⟶ 1,256:
>>> fork() => 0
</pre>
 
=={{header|Perl 6Raku}}==
(formerly Perl 6)
{{Works with|rakudo|2016.06}}
<lang perl6>use NativeCall;
sub fork() returns int32 is native { ... }
 
if fork() -> $pid {
print "I am the proud parent of $pid.\n";
else {
print "I am a child. Have you seen my mommy?\n";
}</lang>
{{out}}
<pre>I am the proud parent of 17691.
I am a child. Have you seen my mommy?</pre>
 
=={{header|REXX}}==
10,333

edits