This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "sfcb - Small Footprint CIM Broker".
The branch, master has been updated
via e8d77713779d38f94248c98c7e6c568e59464fc9 (commit)
from ab857f62a5c9543050b95582e143aed28508b13c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e8d77713779d38f94248c98c7e6c568e59464fc9
Author: Dave Heller <hel...@us...>
Date: Wed Sep 25 17:07:29 2013 -0400
[sfcb-tix:#78] Simplify mutex handling in instance.c
-----------------------------------------------------------------------
Summary of changes:
instance.c | 34 ++++++++--------------------------
1 files changed, 8 insertions(+), 26 deletions(-)
diff --git a/instance.c b/instance.c
index c52e130..3d97c03 100644
--- a/instance.c
+++ b/instance.c
@@ -75,7 +75,10 @@ struct native_instance {
char **key_list;
};
+static pthread_mutex_t gopMtx = PTHREAD_MUTEX_INITIALIZER;
+
#ifdef HAVE_DEFAULT_PROPERTIES
+static pthread_mutex_t ifdpMtx = PTHREAD_MUTEX_INITIALIZER;
static int instFillDefaultProperties(struct native_instance *inst,
const char *ns, const char *cn);
#endif
@@ -497,7 +500,6 @@ __ift_setObjectPath(CMPIInstance *inst, const CMPIObjectPath * cop)
static CMPIObjectPath *
__ift_getObjectPath(const CMPIInstance *instance, CMPIStatus *rc)
{
- static CMPI_MUTEX_TYPE *mtx = NULL;
static UtilHashTable *klt = NULL;
int j,
f = 0;
@@ -541,19 +543,7 @@ __ift_getObjectPath(const CMPIInstance *instance, CMPIStatus *rc)
unsigned int e,
m;
- if (mtx == NULL) {
- int dummy = 0;
- mtx = memAlloc(MEM_TRACKED, sizeof(CMPI_MUTEX_TYPE), &dummy);
- *mtx = Broker->xft->newMutex(0);
- }
- if (! *mtx) {
- mlogf(M_ERROR, M_SHOW, "--- Could not get op for instance of %s; mutex creation failure\n", cn);
- if (rc)
- CMSetStatus(rc, CMPI_RC_ERR_FAILED);
- return NULL;
- }
-
- Broker->xft->lockMutex(*mtx);
+ pthread_mutex_lock(&gopMtx);
if (klt == NULL)
klt = UtilFactory->newHashTable(61,
UtilHashTable_charKey |
@@ -568,11 +558,11 @@ __ift_getObjectPath(const CMPIInstance *instance, CMPIStatus *rc)
if (rc) {
CMSetStatus(rc, CMPI_RC_ERR_INVALID_CLASS);
}
- Broker->xft->unlockMutex(*mtx);
+ pthread_mutex_unlock(&gopMtx);
return NULL;
}
}
- Broker->xft->unlockMutex(*mtx);
+ pthread_mutex_unlock(&gopMtx);
m = kl->ft->getSize(kl, NULL);
for (e = 0; e < m; e++) {
@@ -1088,7 +1078,6 @@ static int
instFillDefaultProperties(struct native_instance *inst,
const char *ns, const char *cn)
{
- static CMPI_MUTEX_TYPE *mtx = NULL;
static UtilHashTable *clt = NULL;
CMPIConstClass *cc;
CMPICount pc;
@@ -1097,14 +1086,7 @@ instFillDefaultProperties(struct native_instance *inst,
CMPIString *pn = NULL;
CMPIValue *vp;
- if (mtx == NULL) {
- mtx = malloc(sizeof(CMPI_MUTEX_TYPE));
- *mtx = Broker->xft->newMutex(0);
- }
- if (!*mtx) {
- return -1;
- }
- Broker->xft->lockMutex(*mtx);
+ pthread_mutex_lock(&ifdpMtx);
if (clt == NULL)
clt =
UtilFactory->newHashTable(61,
@@ -1117,7 +1099,7 @@ instFillDefaultProperties(struct native_instance *inst,
clt->ft->put(clt, strdup(cn), cc->ft->clone(cc, NULL));
}
}
- Broker->xft->unlockMutex(*mtx);
+ pthread_mutex_unlock(&ifdpMtx);
if (cc) {
pc = cc->ft->getPropertyCount(cc, NULL);
while (pc > 0) {
hooks/post-receive
--
sfcb - Small Footprint CIM Broker
|