Source
int discoverer_queue_init(zbx_discoverer_queue_t *queue, int snmpv3_allowed_workers, int checks_per_worker_max,
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/******************************************************************************
* *
* Purpose: locks job queue *
* *
******************************************************************************/
void discoverer_queue_lock(zbx_discoverer_queue_t *queue)
{
pthread_mutex_lock(&queue->lock);
}
/******************************************************************************
* *
* Purpose: unlocks job queue *
* *
******************************************************************************/
void discoverer_queue_unlock(zbx_discoverer_queue_t *queue)
{
pthread_mutex_unlock(&queue->lock);
}
/******************************************************************************
* *
* Purpose: notifies one worker *
* *
* Parameters: queue - [IN] *
* *
* Comments: This function is used by manager to notify worker when single *
* job have been pushed. *
* *
******************************************************************************/
void discoverer_queue_notify(zbx_discoverer_queue_t *queue)
{
int err;
if (0 != (err = pthread_cond_signal(&queue->event)))
zabbix_log(LOG_LEVEL_WARNING, "cannot signal conditional variable: %s", zbx_strerror(err));
}
/******************************************************************************
* *