[pve-devel] [PATCH] add function is_worker

Wolfgang Link w.link at proxmox.com
Tue Jan 26 16:59:38 CET 2016


This function checks if this pid is a current active process.
---
 PVE/RPCEnvironment.pm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/PVE/RPCEnvironment.pm b/PVE/RPCEnvironment.pm
index b3a7dc7..337de1a 100644
--- a/PVE/RPCEnvironment.pm
+++ b/PVE/RPCEnvironment.pm
@@ -1038,4 +1038,14 @@ sub fork_worker {
     return wantarray ? ($upid, $res) : $upid;
 }
 
+sub is_worker {
+    my ($pid) = @_;
+
+    if ($WORKER_PIDS->{$pid}) {
+	return 1;
+    } else {
+	return undef;
+    }
+}
+
 1;
-- 
2.1.4





More information about the pve-devel mailing list