2011-02-10 Ramon Novoa <rnovoa@artica.es>

* pandora_agent: Detach threads to avoid excessive resource usage,
	  since threads were not joined until all modules were executed.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3818 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2011-02-10 11:00:16 +00:00
parent 73f2d1daa0
commit c7e7cd1116
2 changed files with 10 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2011-02-10 Ramon Novoa <rnovoa@artica.es>
* pandora_agent: Detach threads to avoid excessive resource usage,
since threads were not joined until all modules were executed.
2011-02-01 Junichi Satoh <junichi@rworks.jp>
* FreeBSD/pandora_agent.conf: Fixed invalid cpu usage data is returned

View File

@ -39,9 +39,6 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
# Thread list
my @Threads;
# Load thread support
eval {
local $SIG{__DIE__};
@ -1403,7 +1400,7 @@ while (1) {
if (! defined ($thr)) {
$ThreadSem->up ();
} else {
push (@Threads, $thr);
$thr->detach();
}
# Execute the module
} else {
@ -1421,7 +1418,7 @@ while (1) {
if (! defined ($thr)) {
$ThreadSem->up ();
} else {
push (@Threads, $thr);
$thr->detach();
}
# Execute the plugin
} else {
@ -1430,11 +1427,9 @@ while (1) {
}
# Wait for all the threads
foreach my $thread (@Threads) {
$thread->join ();
}
@Threads = ();
$ThreadSem->down ($Conf{'agent_threads'}) if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
$ThreadSem->up ($Conf{'agent_threads'}) if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
$Xml .= "</agent_data>";
# Save XML data file