mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
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:
parent
6584283965
commit
f414ca2b9f
@ -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>
|
2011-02-01 Junichi Satoh <junichi@rworks.jp>
|
||||||
|
|
||||||
* FreeBSD/pandora_agent.conf: Fixed invalid cpu usage data is returned
|
* FreeBSD/pandora_agent.conf: Fixed invalid cpu usage data is returned
|
||||||
|
@ -39,9 +39,6 @@ my $Sem = undef;
|
|||||||
# Semaphore used to control the number of threads
|
# Semaphore used to control the number of threads
|
||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
# Thread list
|
|
||||||
my @Threads;
|
|
||||||
|
|
||||||
# Load thread support
|
# Load thread support
|
||||||
eval {
|
eval {
|
||||||
local $SIG{__DIE__};
|
local $SIG{__DIE__};
|
||||||
@ -1403,7 +1400,7 @@ while (1) {
|
|||||||
if (! defined ($thr)) {
|
if (! defined ($thr)) {
|
||||||
$ThreadSem->up ();
|
$ThreadSem->up ();
|
||||||
} else {
|
} else {
|
||||||
push (@Threads, $thr);
|
$thr->detach();
|
||||||
}
|
}
|
||||||
# Execute the module
|
# Execute the module
|
||||||
} else {
|
} else {
|
||||||
@ -1421,7 +1418,7 @@ while (1) {
|
|||||||
if (! defined ($thr)) {
|
if (! defined ($thr)) {
|
||||||
$ThreadSem->up ();
|
$ThreadSem->up ();
|
||||||
} else {
|
} else {
|
||||||
push (@Threads, $thr);
|
$thr->detach();
|
||||||
}
|
}
|
||||||
# Execute the plugin
|
# Execute the plugin
|
||||||
} else {
|
} else {
|
||||||
@ -1430,11 +1427,9 @@ while (1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Wait for all the threads
|
# Wait for all the threads
|
||||||
foreach my $thread (@Threads) {
|
$ThreadSem->down ($Conf{'agent_threads'}) if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
|
||||||
$thread->join ();
|
$ThreadSem->up ($Conf{'agent_threads'}) if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
|
||||||
}
|
|
||||||
@Threads = ();
|
|
||||||
|
|
||||||
$Xml .= "</agent_data>";
|
$Xml .= "</agent_data>";
|
||||||
|
|
||||||
# Save XML data file
|
# Save XML data file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user