From: Konrad R. <kon...@us...> - 2005-03-23 21:47:39
|
Update of /cvsroot/sblim/indication_helper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30059 Modified Files: ind_helper.c Log Message: 1169451 ] the first call to the monitor function is not evaluated prop Index: ind_helper.c =================================================================== RCS file: /cvsroot/sblim/indication_helper/ind_helper.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ind_helper.c 22 Mar 2005 22:02:55 -0000 1.5 +++ ind_helper.c 23 Mar 2005 21:47:08 -0000 1.6 @@ -47,8 +47,7 @@ */ #define LOCK 0x0002 #define UNLOCK 0x0004 -#define TRIGGER 0x0000 - +#define FIRST_TIME 0x0001 /** * The class properties. This structure is used in three different * ways. @@ -1037,9 +1036,9 @@ else { /* Success locking the critical section */ for (p = monitor_properties.data; p != NULL; - p->flag = UNLOCK,p = p->p) + p->flag = (p->flag & (~LOCK)) | UNLOCK,p = p->p) ; - + if (pthread_mutex_unlock(&monitor_properties.mutex) != 0) { IND_HLP_DEBUG("Unlock mutex error."); @@ -1107,7 +1106,7 @@ for (p=curr, n = 0; p != NULL; n++, p=p->p) { if (p->timer == sleep.timer.tv_sec) - p->flag= LOCK; + p->flag= (p->flag & (~UNLOCK)) | LOCK; else break; } @@ -1148,12 +1147,12 @@ for (p = curr; p!= NULL && rc == IND_OK; p = p->p) { /* Only call functions which are locked */ - if ((p->flag == LOCK) && (p->check != NULL)) + if (((p->flag & LOCK)== LOCK) && (p->check != NULL)) { /* Call the routine */ data.type = CMPI_null; data.state = CMPI_nullValue; - _releaseDataValue(&data); + IND_HLP_DEBUG("Calling the monitor function"); if (p->check(&data) != IND_OK) { @@ -1165,10 +1164,10 @@ _releaseData(&data); break; } - - if (_compareCIMValue(data,p->data) != 0) + if ((_compareCIMValue(data,p->data) != 0) | ((p->flag & FIRST_TIME) == FIRST_TIME)) { /* Yeey, data changed! */ /* Copy the data */ + p->flag = (p->flag & (~FIRST_TIME)); IND_HLP_DEBUG("Yeey, data changed! Generate indication.\n"); _releaseData(&p->data); _cloneData(&p->data, &data); @@ -1200,7 +1199,7 @@ if ((strncmp(p->namespace, q->namespace, ns_l) == 0) && (strncmp(p->cn, q->cn, cn_l) == 0)) { - q->flag = UNLOCK; + q->flag = (q->flag & (~LOCK)) | UNLOCK; } } } @@ -1242,7 +1241,7 @@ /* Unlock all of the properties */ if (pthread_mutex_lock(&monitor_properties.mutex) == 0) { - for (p = monitor_properties.data; p != NULL; p->flag = UNLOCK,p = p->p) + for (p = monitor_properties.data; p != NULL; p->flag = (p->flag & (~LOCK)) | UNLOCK,p = p->p) ; if (pthread_mutex_unlock(&monitor_properties.mutex) != 0) { @@ -1396,7 +1395,7 @@ sizeof(ind_class_property)); /* Set each individual entry */ - property->flag = UNLOCK; + property->flag = UNLOCK | FIRST_TIME; property->p = NULL; property->data.type = CMPI_null; property->data.state = CMPI_nullValue; @@ -1451,6 +1450,8 @@ IND_HLP_DEBUG("Polling routine return code is wrong!"); goto exit_error; } + /* This is where the data is copied in-to memory */ + if ((rc=_cloneData(&property->data, &data)) != IND_OK) { IND_HLP_DEBUG("Could not copy the data passed in from user routine"); @@ -2045,6 +2046,7 @@ switch (data->type) { + /* Add more types */ case CMPI_uint16: data->value.uint16=0; break; |