GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Jonk::Cookbook::ForkModel(3) User Contributed Perl Documentation Jonk::Cookbook::ForkModel(3)

Jonk::Cookbook::ForkModel - with Parallel::Prefork.

prefork worker script:

    #! perl
    use strict;
    use warnings;
    use Parallel::Prefork;
    use DBI;
    use Jonk::Worker;
    use Your::Worker;

    my $pm = Parallel::Prefork->new({
        max_workers       => 10,
        trap_signals      => {
            TERM => 'TERM',
            HUP  => 'TERM',
        },
    });

    while ($pm->signal_received ne 'TERM') {
        $pm->start and next;

        my $dbh = DBI->connect('dbi:mysql:test','user','pass');
        my $jonk = Jonk::Worker->new($dbh => {functions => [qw/worker_key/]});

        while (1) {
            if (my $job = $jonk->dequeue) {
                Your::Worker->work($job);
            } else {
                sleep(3); # wait for 3 sec.
            }
        }

        $pm->finish;
    }

    $pm->wait_all_children();
2010-11-24 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.