Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@BastienDurel
Created February 13, 2014 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BastienDurel/8978392 to your computer and use it in GitHub Desktop.
Save BastienDurel/8978392 to your computer and use it in GitHub Desktop.
thread/fork
#!/usr/bin/perl
use strict;
use threads;
use Proc::Daemon;
sub do_nothing {
sleep 1 while 1;
}
threads->create(\&do_nothing);
threads->create(\&do_nothing);
my $pid = fork();
if (!$pid) {
Proc::Daemon::Init();
exec "/bin/sh", "-c", "echo foo";
}
do_nothing();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment