icinga-powershell-framework/lib/core/thread/Stop-IcingaThread.psm1

19 lines
501 B
PowerShell
Raw Normal View History

function Stop-IcingaThread()
{
2022-03-18 15:58:56 -04:00
param (
[string]$Thread = ''
);
if ([string]::IsNullOrEmpty($Thread)) {
return;
}
2021-12-09 11:42:06 -05:00
if ($Global:Icinga.Public.Threads.ContainsKey($Thread)) {
if ($Global:Icinga.Public.Threads[$Thread].Started -eq $TRUE) {
$Global:Icinga.Public.Threads[$Thread].Shell.Stop();
$Global:Icinga.Public.Threads[$Thread].Handle = $null;
$Global:Icinga.Public.Threads[$Thread].Started = $FALSE;
}
}
}