diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-07-17 18:40:28 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-07-17 18:40:28 +0200 |
commit | 4c9eded44dbae1701bb3b8f255865892b19e7f72 (patch) | |
tree | 0610fa71ff86cba87cce2e1c6c36df26c854ae0b /runtime/wti.h | |
parent | 183b49015561890e148a50128c051a1cdd4491b9 (diff) | |
download | rsyslog-4c9eded44dbae1701bb3b8f255865892b19e7f72.tar.gz rsyslog-4c9eded44dbae1701bb3b8f255865892b19e7f72.tar.xz rsyslog-4c9eded44dbae1701bb3b8f255865892b19e7f72.zip |
further code simplification
... could even remove one mutex by using a better algorithm. I think I also
spotted some situation in which a hang could have happened. As I can't fix it
in v4 and less without moving to the new engine, I make no effort in testing
this out. Hangs occur during shutdown, only (if at all). The code changes
should also result in some mild performance improvement. Some bug potential,
but overall the bug potential should have been greatly reduced.
Diffstat (limited to 'runtime/wti.h')
-rw-r--r-- | runtime/wti.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/runtime/wti.h b/runtime/wti.h index 56901165..67d89a2f 100644 --- a/runtime/wti.h +++ b/runtime/wti.h @@ -33,29 +33,23 @@ /* the worker thread instance class */ struct wti_s { BEGINobjInstance; - pthread_t thrdID; /* thread ID */ - qWrkCmd_t tCurrCmd; /* current command to be carried out by worker */ + pthread_t thrdID; /* thread ID */ + bool bIsRunning; /* is this thread currently running? */ wtp_t *pWtp; /* my worker thread pool (important if only the work thread instance is passed! */ - pthread_mutex_t mut; batch_t batch; /* pointer to an object array meaningful for current user pointer (e.g. queue pUsr data elemt) */ - bool bShutdownRqtd; /* shutdown for this thread requested? 0 - no , 1 - yes */ uchar *pszDbgHdr; /* header string for debug messages */ }; -/* some symbolic constants for easier reference */ - /* prototypes */ rsRetVal wtiConstruct(wti_t **ppThis); rsRetVal wtiConstructFinalize(wti_t *pThis); rsRetVal wtiDestruct(wti_t **ppThis); rsRetVal wtiWorker(wti_t *pThis); -rsRetVal wtiProcessThrdChanges(wti_t *pThis, int bLockMutex); rsRetVal wtiSetDbgHdr(wti_t *pThis, uchar *pszMsg, size_t lenMsg); -rsRetVal wtiSetState(wti_t *pThis, qWrkCmd_t tCmd, int bLockMutex); -rsRetVal wtiJoinThrd(wti_t *pThis); rsRetVal wtiCancelThrd(wti_t *pThis); -qWrkCmd_t wtiGetState(wti_t *pThis, int bLockMutex); +rsRetVal wtiSetState(wti_t *pThis, bool bNew); +bool wtiGetState(wti_t *pThis); PROTOTYPEObjClassInit(wti); PROTOTYPEpropSetMeth(wti, pszDbgHdr, uchar*); PROTOTYPEpropSetMeth(wti, pWtp, wtp_t*); |