diff options
author | Michael Biebl <biebl@debian.org> | 2014-04-03 03:08:50 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2014-04-03 03:08:50 +0200 |
commit | 9374a46543e9c43c009f80def8c3b2506b0b377e (patch) | |
tree | 8853fd40ee8d55ff24304ff8a4421640f3493c58 /plugins/mmcount/mmcount.c | |
parent | 209e193f14ec562df5aad945f04cd88b227cc602 (diff) | |
download | rsyslog-upstream/8.2.0.tar.gz |
Imported Upstream version 8.2.0upstream/8.2.0
Diffstat (limited to 'plugins/mmcount/mmcount.c')
-rw-r--r-- | plugins/mmcount/mmcount.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/mmcount/mmcount.c b/plugins/mmcount/mmcount.c index 8a40e38..f5fc001 100644 --- a/plugins/mmcount/mmcount.c +++ b/plugins/mmcount/mmcount.c @@ -59,8 +59,13 @@ typedef struct _instanceData { char *pszValue; int valueCounter; struct hashtable *ht; + pthread_mutex_t mut; } instanceData; +typedef struct wrkrInstanceData { + instanceData *pData; +} wrkrInstanceData_t; + struct modConfData_s { rsconf_t *pConf; /* our overall config object */ }; @@ -107,8 +112,13 @@ ENDfreeCnf BEGINcreateInstance CODESTARTcreateInstance + pthread_mutex_init(&pData->mut, NULL); ENDcreateInstance +BEGINcreateWrkrInstance +CODESTARTcreateWrkrInstance +ENDcreateWrkrInstance + BEGINisCompatibleWithFeature CODESTARTisCompatibleWithFeature @@ -120,6 +130,10 @@ CODESTARTfreeInstance ENDfreeInstance +BEGINfreeWrkrInstance +CODESTARTfreeWrkrInstance +ENDfreeWrkrInstance + static inline void setInstParamDefaults(instanceData *pData) { @@ -250,10 +264,12 @@ BEGINdoAction struct json_object *keyjson = NULL; char *pszValue; int *pCounter; + instanceData *const pData = pWrkrData->pData; CODESTARTdoAction pMsg = (msg_t*) ppString[0]; appname = getAPPNAME(pMsg, LOCK_MUTEX); + pthread_mutex_lock(&pData->mut); if(0 != strcmp(appname, pData->pszAppName)) { /* we are not working for this appname. nothing to do */ ABORT_FINALIZE(RS_RET_OK); @@ -295,6 +311,7 @@ CODESTARTdoAction json = json_object_new_int(*pCounter); } finalize_it: + pthread_mutex_unlock(&pData->mut); if(estr) { es_deleteStr(estr); } @@ -327,6 +344,7 @@ ENDmodExit BEGINqueryEtryPt CODESTARTqueryEtryPt CODEqueryEtryPt_STD_OMOD_QUERIES +CODEqueryEtryPt_STD_OMOD8_QUERIES CODEqueryEtryPt_STD_CONF2_OMOD_QUERIES CODEqueryEtryPt_STD_CONF2_QUERIES ENDqueryEtryPt |