HTTP::Daemon::Threaded
package HTTP::Daemon::Threaded;
use threads;
use Thread::Apartment;
use base qw(Thread::Apartment);
use strict;
use warnings;
our $VERSION = '0.91';
our $container;
our $timeout;
sub setTimeout { $timeout = ($_[0] eq 'HTTP::Daemon::Threaded') ? $_[1] : $_[0]; }
sub new {
#
# overrides T::A new, returning the container object
#
my ($class, %args) = @_;
$args{AptClass} = 'HTTP::Daemon::Threaded::Listener';
$args{AptTimeout} = $timeout
unless exists $args{AptTimeout};
$container = Thread::Apartment->new( %args )
|| die "Could not install into an apartment: $@.";
return $container;
}
1;