Source
xxxxxxxxxx
if (NULL == (sequence = (zbx_pp_item_task_sequence_t *)zbx_hashset_search(&queue->sequences, &task->itemid)))
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
ZBX_PTR_VECTOR_IMPL(pp_sequence_stats_ptr, zbx_pp_sequence_stats_t *)
/* task sequence registry by itemid */
typedef struct
{
zbx_uint64_t itemid;
zbx_pp_task_t *task;
}
zbx_pp_item_task_sequence_t;
/******************************************************************************
* *
* Purpose: initialize task queue *
* *
* Parameters: queue - [IN] task queue *
* error - [OUT] *
* *
* Return value: SUCCEED - the task queue was initialized successfully *
* FAIL - otherwise *
* *
******************************************************************************/
int pp_task_queue_init(zbx_pp_queue_t *queue, char **error)
{
int err, ret = FAIL;
queue->workers_num = 0;
queue->pending_num = 0;
queue->finished_num = 0;
queue->processing_num = 0;
zbx_list_create(&queue->pending);
zbx_list_create(&queue->immediate);
zbx_list_create(&queue->finished);
zbx_hashset_create(&queue->sequences, 100, ZBX_DEFAULT_UINT64_HASH_FUNC, ZBX_DEFAULT_UINT64_COMPARE_FUNC);