Main > Programming > Libraries >

Proc::Forking 1.38

Proc::Forking 1.38

Sponsored Links

Proc::Forking 1.38 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.011 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 962
Date added: 2007-03-06
Publisher: Fabrice DULAUNOY

Proc::Forking 1.38 description

Proc::Forking is a Perl module that provides a set of tool to fork and daemonize.

SYNOPSIS

#!/usr/bin/perl

use strict;
use Proc::Forking;
use Data::Dumper;
use Time::HiRes qw(usleep); # to allow micro sleep

my $f = Proc::Forking->new();
$SIG{ KILL } = $SIG{ TERM } = $SIG{ INT } = sub { $f->killall_childs;sleep 1; exit },
$f->daemonize(
## uid => 1000,
## gid => 1000,
## home => "/tmp",
pid_file => "/tmp/master.pid"
);

open( STDOUT, ">>/tmp/master.log" );
my $nbr = 0;
my $timemout;

while ( 1 )
{
if ( $nbr < 20 )
{
my $extra = "other parameter";
my ( $status, $pid, $error ) = $f->fork_child(
function => &func,
name => "new_name.##",
args => [ "hello SOMEONE", 3, $extra ],
pid_file => "/tmp/fork.##.pid",
uid => 1000,
gid => 1000,
home => "/tmp",
max_load => 5,
max_mem => 185000000,
expiration => 10,
# expiration_auto => 1,
);
if ( $status == 4 ) # if the load become to high
{
print "Max load reached, do a little napn";
usleep( 100000 );
next;
}
elsif ( $status ) # if another kind of error

{
print "PID=$pidt error=$errorn";
print Dumper( $f->list_names() );
print Dumper( $f->list_pids() );
}
}
$nbr = $f->pid_nbr;
my ( $n, @dp, @dn ) = $f->expirate;
if ( $n )
{
print Dumper( @dp );
}
print "free=<" . scalar( $f->getmemfree ) . ">n";
usleep( 100000 ); # always a good idea to put a small sleep to allow task swapper to gain some free resources
}

sub func
{
my $ref = shift;
my @args = @$ref;
my ( $data, $time_out, $sockC ) = @args;
$SIG{ USR1 } = sub { open my $log, ">>/tmp/log.s"; print $log "signal USR1 receivedn"; close $log; };
if ( !$time_out )
{
$time_out = 3;
}
open my $FF, ">>/tmp/loglist";
print $FF $$, " start time =", $^T;
close $FF;

for ( 1 .. 4 )
{
open my $fh, ">>/tmp/log";
if ( defined $fh )
{
print $fh "TMOUT = $time_out " . time . " PID=$$ cwd=" . Cwd::cwd() . " name =$0n";
$fh->close;
}
sleep $time_out + rand( 5 );
}
}

Proc::Forking 1.38 Screenshot

Advertisements

Proc::Forking 1.38 Keywords

Bookmark Proc::Forking 1.38

Hyperlink code:
Link for forum:

Proc::Forking 1.38 Copyright

WareSeeker periodically updates pricing and software information of Proc::Forking 1.38 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Proc::Forking 1.38 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Proc::Fork is a simple, intuitive interface to the fork() system call. Free Download
fork allows you to run a number of processes in parallel. Free Download
DB Designer Fork is a fork of the fabFORCE DBDesigner 4. Free Download
Benchmark::Forking is a Perl module to run benchmarks in separate processes. Free Download
Apache::Storage is Perl module containing simple functions to store and retrieve information from within the Apache process. Free Download
Proc::BackOff::Linear is directly inherited from and then modified by overloading the calculate_back_off object method. Free Download
Time::Progress Perl module contains elapsed and estimated finish time reporting. Free Download
DBD::ODBC::Changes is a Perl module with logs of significant changes to the DBD::ODBC. Free Download