10 use constant THREAD_COUNT => 5;
12 my @count : shared = (0, (0) x THREAD_COUNT);
17 my $in = IO::Handle->new;
18 my $out = IO::Handle->new;
19 my $err = IO::Handle->new;
21 my $request = FCGI::Request($in, $out, $err, \%env);
23 while ($request->Accept >= 0) {
25 "Content-type: text/html\r\n",
27 "<title>FastCGI Hello! (multi-threaded perl, fcgiapp library)</title>",
28 "<h1>FastCGI Hello! (multi-threaded perl, fcgiapp library)</h1>",
29 "Request counts for ", THREAD_COUNT ," threads ",
30 "running on host <i>$env{SERVER_NAME}</i>";
37 for(my $i = 1; $i <= THREAD_COUNT; $i++) {
38 print $out $count[$i];
47 $_->join for map { threads->create(\&worker, $_) } 1..THREAD_COUNT;