Perl5 to Java compiler - integrating with java.lang.Thread
Here is another experiment with calling Java libraries from Perlito5-Java; using JVM threads:
package Java::Thread {
import => "java.lang.Thread"
};
my Java::Thread $thread1 = new Java::Thread(
sub {
for my $i (0..10) {
print "thread 1\n";
sleep (1);
}
}
);
my Java::Thread $thread2 = new Java::Thread(
sub {
for my $i (0..10) {
print "thread 2\n";
sleep (1);
}
}
);
$thread1->start();
$thread2->start();
The source code is at https://github.com/fglock/Perlito/blob/master/misc/Java/TestThread.pl; I've tested with javac 1.7.0_79 in Ubuntu.
Leave a comment