|
Packit Service |
310c69 |
/*
|
|
Packit Service |
310c69 |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
310c69 |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
310c69 |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
310c69 |
* of the License, or (at your option) any later version.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
310c69 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
310c69 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
310c69 |
* GNU General Public License for more details.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
310c69 |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
310c69 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
310c69 |
* 02110-1301, USA.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* $Id: //eng/uds-releases/jasper/src/uds/requestQueue.h#1 $
|
|
Packit Service |
310c69 |
*/
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#ifndef REQUEST_QUEUE_H
|
|
Packit Service |
310c69 |
#define REQUEST_QUEUE_H
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#include "opaqueTypes.h"
|
|
Packit Service |
310c69 |
#include "typeDefs.h"
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/* void return value because this function will process its own errors */
|
|
Packit Service |
310c69 |
typedef void RequestQueueProcessor(Request *);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Allocate a new request processing queue and start a worker thread to
|
|
Packit Service |
310c69 |
* consume and service requests in the queue.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param queueName the name of the queue and the worker thread
|
|
Packit Service |
310c69 |
* @param processOne the function the worker will invoke on each request
|
|
Packit Service |
310c69 |
* @param queuePtr a pointer to receive the new queue
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return UDS_SUCCESS or an error code
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
int makeRequestQueue(const char *queueName,
|
|
Packit Service |
310c69 |
RequestQueueProcessor *processOne,
|
|
Packit Service |
310c69 |
RequestQueue **queuePtr)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Add a request to the end of the queue for processing by the worker thread.
|
|
Packit Service |
310c69 |
* If the requeued flag is set on the request, it will be processed before
|
|
Packit Service |
310c69 |
* any non-requeued requests under most circumstances.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param queue the request queue that should process the request
|
|
Packit Service |
310c69 |
* @param request the request to be processed on the queue's worker thread
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void requestQueueEnqueue(RequestQueue *queue, Request *request);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Shut down the request queue worker thread, then destroy and free the queue.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param queue the queue to shut down and free
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void requestQueueFinish(RequestQueue *queue);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#endif /* REQUEST_QUEUE_H */
|