NAME

IPC::Concurrency::DBI::Application::Instance - Application instance that represents consumption of the limited resource.

VERSION

Version 1.2.0

SYNOPSIS

This module represents one instance of an application managed by IPC::Concurrency::DBI.

See the documentation of IPC::Concurrency::DBI for more information.

my $instance = $concurrent_program->start_instance();
unless ( defined( $instance ) )
{
	print "Too many instances of $0 are already running.\n";
	exit;
}

# [...] Do some work.

# Now that the application is about to exit, flag the instance as completed.
# (note: this is implicit when $instance is destroyed).
$instance->finish();

METHODS

new()

Create a new IPC::Concurrency::DBI::Application::Instance object.

This function should not be called directly and its API could change, instead use IPC::Concurrency::DBI::Application::start_instance().

# Retrieve the application by name.
my $instance = IPC::Concurrency::DBI::Application::Instance->new(
	application => $application,
);

'application': mandatory, an IPC::Concurrency::DBI::Application object.

finish()

Declare that the current instance has finished running and free the slot for a new instance.

INTERNAL METHODS

get_application()

Returns the parent IPC::Concurrency::DBI::Application object.

my $application = $instance->get_application();

DESTROY()

Automatically clear the slot used by the current instance when the object is destroyed, if finish() has not been called already.

BUGS

Please report any bugs or feature requests through the web interface at https://github.com/guillaumeaubert/IPC-Concurrency-DBI/issues/new. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc IPC::Concurrency::DBI

You can also look for information at:

AUTHOR

Guillaume Aubert, <aubertg at cpan.org>.

COPYRIGHT & LICENSE

Copyright 2011-2017 Guillaume Aubert.

This code is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file for more details.