Changeset 4253 for trunk/MagicSoft
- Timestamp:
- 06/01/04 16:24:08 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MLog.cc
r3957 r4253 361 361 362 362 // lock mutex 363 LockUpdate("UpdateGui"); 363 if (!LockUpdate("UpdateGui")) 364 { 365 Warning("UpdateGui", "Execution skipped"); 366 return; 367 } 364 368 365 369 TGText &txt=*fGui->GetText(); … … 392 396 } 393 397 394 voidMLog::LockUpdate(const char *msg)398 bool MLog::LockUpdate(const char *msg) 395 399 { 396 400 #ifdef _REENTRANT 397 401 if (fMuxGui->Lock()==13) 398 Error("LockUpdate", "%s - mutex is already locked by this thread\n", msg); 399 #endif 400 } 401 402 void MLog::UnLockUpdate(const char *msg) 402 { 403 Info("LockUpdate", "%s - mutex is already locked by this thread\n", msg); 404 return false; 405 } 406 return true; 407 #endif 408 } 409 410 bool MLog::UnLockUpdate(const char *msg) 403 411 { 404 412 #ifdef _REENTRANT 405 413 if (fMuxGui->UnLock()==13) 406 Error("UnLockUpdate", "%s - tried to unlock mutex locked by other thread\n", msg); 407 #endif 408 } 409 410 void MLog::Lock(const char *msg) 414 { 415 Info("UnLockUpdate", "%s - tried to unlock mutex locked by other thread\n", msg); 416 return false; 417 } 418 return true; 419 #endif 420 } 421 422 bool MLog::Lock(const char *msg) 411 423 { 412 424 #ifdef _REENTRANT 413 425 if (fMuxStream->Lock()==13) 426 { 414 427 Error("Lock", "%s - mutex is already locked by this thread\n", msg); 415 #endif 416 } 417 418 void MLog::UnLock(const char *msg) 428 return false; 429 } 430 // while (fMuxStream->Lock()==13) 431 // usleep(1); 432 // { 433 // Error("Lock", "%s - mutex is already locked by this thread\n", msg); 434 // return false; 435 // } 436 return true; 437 #endif 438 } 439 440 bool MLog::UnLock(const char *msg) 419 441 { 420 442 #ifdef _REENTRANT 421 443 if (fMuxStream->UnLock()==13) 444 { 422 445 Error("UnLock", "%s - tried to unlock mutex locked by other thread\n", msg); 446 return false; 447 } 448 return true; 423 449 #endif 424 450 } … … 430 456 int MLog::sync() 431 457 { 432 LockUpdate("sync"); 458 if (!LockUpdate("sync")) 459 usleep(1); 433 460 WriteBuffer(); 434 461 UnLockUpdate("sync"); … … 466 493 if (fOutputLevel <= fDebugLevel) 467 494 { 468 LockUpdate("overflow"); 495 if (!LockUpdate("overflow")) 496 usleep(1); 469 497 470 498 *fPPtr++ = (char)i; -
trunk/MagicSoft/Mars/mbase/MLog.h
r3957 r4253 103 103 ~MLog(); 104 104 105 voidLockUpdate(const char *msg);106 voidUnLockUpdate(const char *msg);107 108 voidLock(const char *msg="");109 voidUnLock(const char *msg="");105 bool LockUpdate(const char *msg); 106 bool UnLockUpdate(const char *msg); 107 108 bool Lock(const char *msg=""); 109 bool UnLock(const char *msg=""); 110 110 111 111 void EnableDirectGui() { fIsDirectGui = kTRUE; }
Note:
See TracChangeset
for help on using the changeset viewer.