Add Logger::stop_online_logging().

This commit is contained in:
Daniel Nichter
2013-05-20 14:03:39 -07:00
parent 20c3bd6c29
commit 99592409e6
2 changed files with 20 additions and 6 deletions

View File

@@ -207,13 +207,20 @@ sub _log {
return;
}
sub DESTROY {
sub stop_online_logging {
my $self = shift;
if ( $self->online_logging ) {
if ( $self->_thread && $self->_thread->is_running() ) {
my @stop :shared = (undef, undef);
$self->_message_queue->enqueue(\@stop); # stop the thread
$self->_thread->join();
}
$self->online_logging(0);
return;
}
sub DESTROY {
my $self = shift;
$self->stop_online_logging();
return;
}