Changeset 12892 for fact/Evidence
- Timestamp:
- 02/15/12 17:30:45 (13 years ago)
- Location:
- fact/Evidence
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/Evidence/Evidence.cc
r11258 r12892 93 93 EvidenceServer *EvidenceServer::This = NULL; 94 94 pthread_mutex_t EvidenceServer::Mutex; 95 set<pthread_t> EvidenceServer::Threads;96 97 95 98 96 // Constructor … … 104 102 ExitRequest = false; 105 103 This = this; 106 Threads.insert(pthread_self());107 104 108 105 // Initialise mutex … … 258 255 259 256 string Result; 260 bool Blocking = false;261 257 262 258 // If up-to-date data in configuration list available, return this 263 259 Lock(); 264 260 if ((List.count(Item) > 0) && (List[Item].Time >= ConfClass->ConfigTimeStamp)) Result = List[Item].Value; 265 if (Threads.count(pthread_self()) != 0) Blocking = true;266 261 Unlock(); 267 262 if (!Result.empty()) return Result; 268 263 269 // Blocking configuration request270 if (Blocking) { 264 if (inCallback() == 0) { 265 // Blocking configuration request 271 266 DimRpcInfo Config((char *) "ConfigRequest", NO_LINK); 272 267 Config.setData((char *) (Name + " " + Item).c_str()); … … 292 287 } 293 288 } 294 295 // Non-blocking configuration request 296 if (!Blocking) { 289 else { 290 // Non-blocking configuration request 297 291 Lock(); 298 292 … … 346 340 void EvidenceServer::CallConfigChanged() { 347 341 348 EvidenceServer::Lock();349 EvidenceServer::Threads.insert(pthread_self());350 EvidenceServer::Unlock();351 352 342 This->ConfigChanged(); 353 354 EvidenceServer::Lock();355 EvidenceServer::Threads.erase(pthread_self());356 EvidenceServer::Unlock();357 343 } 358 344 … … 434 420 return Text.str(); 435 421 } 422 423 // Simplify format "?;1" to "?" 424 if (strlen(Format)==3 && Format[2]=='1') Format[1] = '\0'; 436 425 437 426 // Structure: print hex representation … … 450 439 // Number array 451 440 int ElementSize; 452 switch (*Format) { 441 switch (toupper(*Format)) { 442 case 'B': 443 case 'V': 453 444 case 'C': ElementSize = sizeof(char); break; 454 445 case 'I': … … 466 457 467 458 // Translate data 468 switch (*Format) { 459 switch (toupper(*Format)) { 460 case 'B': 461 case 'V': 469 462 case 'C': Text << *((char *) Data + i); break; 470 463 case 'I': -
fact/Evidence/Evidence.h
r10143 r12892 59 59 class Config *ConfClass; 60 60 static pthread_mutex_t Mutex; 61 static std::set<pthread_t> Threads;62 61 static EvidenceServer *This; 63 62 -
fact/Evidence/readme.txt
r11258 r12892 54 54 6/7/2011 Missing pthread_mutexattr_init() in Evidence constructor caused spurious errors when 55 55 locking mutex 56 2/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.