3543 unsigned long sleepTime = 0;
3544 IntItemNode* current = 0;
3546 unsigned long innerCounter = 0;
3547 unsigned long outerCounter = 0;
3553 status = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
3556 printf(
"Set cancel state error [mon - int]: %d\n", status);
3560 "Unable to configure monitor thread (int) properly. Monitoring is not affected.", 0);
3562 status = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
3565 printf(
"Set cancel type error [mon - int]: %d\n", status);
3569 "Unable to configure monitor thread (int) properly. Monitoring is not affected.", 0);
3572 createLogMessage(MSG_DEBUG,
"Started monitor thread for INT values successfully.", 0);
3577 while (current != 0) {
3579 msg[
sprintf(msg,
"Value of item %s (int) is corrupt, reconstruction failed. Ignoring!",
3580 current->intItem->name)] = 0;
3585 if ((abs((*(current->intItem->location)) - current->lastTransmittedIntValue)
3586 >= current->threshold) || (outerCounter ==
3587 (innerCounter * TIME_INTERVAL_MULTIPLIER))) {
3589 current->lastTransmittedIntValue = *(current->intItem->location);
3591 printf(
"CE triggered an updated on %d clients for service %s [int]: %d\n",
3592 nRet, current->intItem->name, *(current->intItem->location));
3599 current = current->next;
3600 usleep(sleepTime * 1000);
3610 if (outerCounter >= (
intNodesAmount * TIME_INTERVAL_MULTIPLIER)) {
bool checkIntLocation(IntItemNode *node)
static unsigned short updateRate
static IntItemNode * firstIntNode
static bool intMonitorThreadStarted
static unsigned int intNodesAmount
void createLogMessage(unsigned int type, char *description, char *origin)
#define dis_update_service
sprintf(name1,"NewService%d", i)