Thread Das Modul "forks" (3 answers)
Opened by Gast at 2008-06-06 10:37

Gast Gast
 2008-06-24 21:59
#111474 #111474
Gibt es eine Möglichkeit, die beiden Threads anstatt hintereinander parallel laufen zu lassen?

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /usr/bin/perl
use forks;
use strict;
use warnings;



my $thread1 = threads->new( func( 0 ) );
my $thread2 = threads->new( func( 30 ) );

$thread1->join;
$thread2->join;


sub func {
        foreach ( 1..100000 ) {
                print " " x $_[0], $_, "\n"
        }
        return 1;
}

View full thread Das Modul "forks"