Changeset 12892 for fact/Evidence


Ignore:
Timestamp:
02/15/12 17:30:45 (13 years ago)
Author:
ogrimm
Message:
New inCallback() method of DIM version v19r23 used
Location:
fact/Evidence
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fact/Evidence/Evidence.cc

    r11258 r12892  
    9393EvidenceServer *EvidenceServer::This = NULL;
    9494pthread_mutex_t EvidenceServer::Mutex;
    95 set<pthread_t> EvidenceServer::Threads;
    96 
    9795
    9896// Constructor
     
    104102  ExitRequest = false;
    105103  This = this;
    106   Threads.insert(pthread_self());
    107104
    108105  // Initialise mutex
     
    258255
    259256  string Result;
    260   bool Blocking = false;
    261257 
    262258  // If up-to-date data in configuration list available, return this
    263259  Lock();
    264260  if ((List.count(Item) > 0) && (List[Item].Time >= ConfClass->ConfigTimeStamp)) Result = List[Item].Value;
    265   if (Threads.count(pthread_self()) != 0) Blocking = true;
    266261  Unlock();
    267262  if (!Result.empty()) return Result;
    268263
    269   // Blocking configuration request
    270   if (Blocking) {
     264  if (inCallback() == 0) {
     265        // Blocking configuration request
    271266        DimRpcInfo Config((char *) "ConfigRequest", NO_LINK);
    272267        Config.setData((char *) (Name + " " + Item).c_str());
     
    292287        }       
    293288  }
    294 
    295   // Non-blocking configuration request
    296   if (!Blocking) {
     289  else {
     290        // Non-blocking configuration request
    297291        Lock();
    298292
     
    346340void EvidenceServer::CallConfigChanged() {
    347341
    348   EvidenceServer::Lock();
    349   EvidenceServer::Threads.insert(pthread_self());
    350   EvidenceServer::Unlock();
    351 
    352342  This->ConfigChanged();
    353  
    354   EvidenceServer::Lock();
    355   EvidenceServer::Threads.erase(pthread_self());
    356   EvidenceServer::Unlock();
    357343}
    358344
     
    434420        return Text.str();
    435421  }
     422
     423  // Simplify format "?;1" to "?"
     424  if (strlen(Format)==3 && Format[2]=='1') Format[1] = '\0';
    436425 
    437426  // Structure: print hex representation
     
    450439  // Number array
    451440  int ElementSize;
    452   switch (*Format) {
     441  switch (toupper(*Format)) {
     442    case 'B':
     443        case 'V':
    453444    case 'C': ElementSize = sizeof(char);               break;
    454445    case 'I':
     
    466457
    467458        // Translate data
    468         switch (*Format) {
     459        switch (toupper(*Format)) {
     460          case 'B':
     461          case 'V':
    469462      case 'C': Text << *((char *) Data + i);           break;
    470463      case 'I':
  • fact/Evidence/Evidence.h

    r10143 r12892  
    5959        class Config *ConfClass;
    6060        static pthread_mutex_t Mutex;
    61         static std::set<pthread_t> Threads;
    6261        static EvidenceServer *This;
    6362
  • fact/Evidence/readme.txt

    r11258 r12892  
    54546/7/2011        Missing pthread_mutexattr_init() in Evidence constructor caused spurious errors when
    5555                        locking mutex
     562/8/2011        Used inCallback() method of DIM version v19r23 to decide between blocking or non-blocking config request.
     57                        Updated EvidenceServer::ToString() for B and V formats.
Note: See TracChangeset for help on using the changeset viewer.