summaryrefslogtreecommitdiff
path: root/torrus/setup_tools/check_perlthreading.pl
diff options
context:
space:
mode:
authorivan <ivan>2010-12-27 00:04:44 +0000
committerivan <ivan>2010-12-27 00:04:44 +0000
commit74e058c8a010ef6feb539248a550d0bb169c1e94 (patch)
tree6e8d3efb218dd0f41970b62c7f29758d1ae9a937 /torrus/setup_tools/check_perlthreading.pl
parent35359a73152b3d7a9ad5e3d37faf81f6fedb76e8 (diff)
import torrus 1.0.9
Diffstat (limited to 'torrus/setup_tools/check_perlthreading.pl')
-rw-r--r--torrus/setup_tools/check_perlthreading.pl37
1 files changed, 37 insertions, 0 deletions
diff --git a/torrus/setup_tools/check_perlthreading.pl b/torrus/setup_tools/check_perlthreading.pl
new file mode 100644
index 000000000..22666e3c0
--- /dev/null
+++ b/torrus/setup_tools/check_perlthreading.pl
@@ -0,0 +1,37 @@
+
+use threads;
+
+$| = 1;
+
+print "The child thread must keep ticking while the main thread sleeps\n";
+print "If it's not so, then we have a compatibility problem\n";
+
+
+
+my $thrChild = threads->create( \&child );
+$thrChild->detach();
+
+print "P> Launched the child thread. Now I sleep 20 seconds\n";
+sleep(20);
+print "P> Parent woke up. Was there ticking inbetween?\n";
+
+exit 0;
+
+
+
+sub child
+{
+ print "C> Child thread started. I will print 10 lines, one per second\n";
+
+ foreach my $i (1..10)
+ {
+ print("C> Child tick " . $i . "\n");
+ sleep(1);
+ }
+}
+
+
+
+
+
+