2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

Blocking.pm: add blockinginfo command (Forum #73490)

git-svn-id: https://svn.fhem.de/fhem/trunk@14649 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-07-05 07:19:44 +00:00
parent 5e1e89fe95
commit 4912e959fb

View File

@ -26,8 +26,8 @@ sub BlockingKill($);
sub BlockingInformParent($;$$);
sub BlockingStart(;$);
use vars qw($BC_telnetDevice);
use vars qw(%BC_hash);
our $BC_telnetDevice;
our %BC_hash;
my $telnetClient;
my $bc_pid = 0;
@ -73,9 +73,30 @@ BC_searchTelnet($)
}
}
sub
BlockingInfo($$@)
{
my @ret;
foreach my $h (values %BC_hash) {
next if($h->{terminated} || !$h->{pid});
my $fn = (ref($h->{fn}) ? ref($h->{fn}) : $h->{fn});
my $arg = (ref($h->{arg}) ? ref($h->{arg}) : $h->{arg});
my $to = ($h->{timeout} ? $h->{timeout} : "N/A");
push @ret, "Pid:$h->{pid} Fn:$fn Arg:$arg Timeout:$to";
}
push @ret, "No BlockingCall processes running currently" if(!@ret);
return join("\n", @ret);
}
sub
BlockingCall($$@)
{
my %hash = (
Fn => "BlockingInfo",
Hlp => ",show info about processes started by BlockingCall"
);
$cmds{blockinginfo} = \%hash;
my ($blockingFn, $arg, $finishFn, $timeout, $abortFn, $abortArg) = @_;
my %h = ( pid=>'WAITING:', fn=>$blockingFn, arg=>$arg, finishFn=>$finishFn,