Thread Korrektes gabeln (fork) unter Apache/Windows (war: Korrektes fork'en ?) (32 answers)
Opened by bianca at 2010-05-31 18:38

bianca
 2010-06-02 18:42
#137916 #137916
User since
2009-09-13
6978 Artikel
BenutzerIn

user image
Auch wenn es mich genau so wundert wie pq, das funktioniert bei mir!!! *freu*
Auf jeden Fall schonmal ein fettes Danke an kristian.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl -W
use strict;
use warnings;
use IO::Handle; STDOUT -> autoflush (1);
use CGI;
my $zeit = time;
print CGI -> new -> header . <<HTML_TEIL;
<html>
        <head>
        </head>
        <body>
                <p>Bin da um $zeit mit PID $$</p>
        </body>
</html>
HTML_TEIL
close STDOUT;   # end pipe to webserver

if (my $pid = fork ()) {
        # parent
        # PID of parent = $$
        # PID of child = $pid
        open (my $fh,">test.parent.$$" . "_fork_to_$pid.txt");
        print $fh "test";
        # /parent
}
else {
        # child
        # $pid = 0
        # PID of child = $$
        sleep 10;
        open (my $fh,">test.child.$$.txt");
        print $fh "test";
        # /child
}
10 print "Hallo"
20 goto 10
Antworten mit Zitat

View full thread Korrektes gabeln (fork) unter Apache/Windows (war: Korrektes fork'en ?)