1
/* Definition of the worker thread instance (wti) class.
3
* Copyright 2008 Rainer Gerhards and Adiscon GmbH.
5
* This file is part of the rsyslog runtime library.
7
* The rsyslog runtime library is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* The rsyslog runtime library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public License
18
* along with the rsyslog runtime library. If not, see <http://www.gnu.org/licenses/>.
20
* A copy of the GPL can be found in the file "COPYING" in this distribution.
21
* A copy of the LGPL can be found in the file "COPYING.LESSER" in this distribution.
24
#ifndef WTI_H_INCLUDED
25
#define WTI_H_INCLUDED
31
/* the worker thread instance class */
32
typedef struct wti_s {
34
pthread_t thrdID; /* thread ID */
35
qWrkCmd_t tCurrCmd; /* current command to be carried out by worker */
36
obj_t *pUsrp; /* pointer to an object meaningful for current user pointer (e.g. queue pUsr data elemt) */
37
wtp_t *pWtp; /* my worker thread pool (important if only the work thread instance is passed! */
38
pthread_cond_t condInitDone; /* signaled when the thread startup is done (once per thread existance) */
39
pthread_cond_t condExitDone; /* signaled when the thread exit is done (once per thread existance) */
41
int bShutdownRqtd; /* shutdown for this thread requested? 0 - no , 1 - yes */
42
uchar *pszDbgHdr; /* header string for debug messages */
45
/* some symbolic constants for easier reference */
49
rsRetVal wtiConstruct(wti_t **ppThis);
50
rsRetVal wtiConstructFinalize(wti_t *pThis);
51
rsRetVal wtiDestruct(wti_t **ppThis);
52
rsRetVal wtiWorker(wti_t *pThis);
53
rsRetVal wtiProcessThrdChanges(wti_t *pThis, int bLockMutex);
54
rsRetVal wtiSetDbgHdr(wti_t *pThis, uchar *pszMsg, size_t lenMsg);
55
rsRetVal wtiSetState(wti_t *pThis, qWrkCmd_t tCmd, int bActiveOnly, int bLockMutex);
56
rsRetVal wtiJoinThrd(wti_t *pThis);
57
rsRetVal wtiCancelThrd(wti_t *pThis);
58
qWrkCmd_t wtiGetState(wti_t *pThis, int bLockMutex);
59
PROTOTYPEObjClassInit(wti);
60
PROTOTYPEpropSetMeth(wti, pszDbgHdr, uchar*);
61
PROTOTYPEpropSetMeth(wti, pWtp, wtp_t*);
63
#endif /* #ifndef WTI_H_INCLUDED */