Ignore:
Timestamp:
05/04/04 15:27:25 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r3927 r3957  
    149149    //
    150150#ifdef _REENTRANT
    151     fMuxGui = new TMutex;
     151    fMuxGui    = new TMutex;
     152    fMuxStream = new TMutex;
    152153#endif
    153154
     
    213214    delete fPlugins;
    214215#ifdef _REENTRANT
     216    delete fMuxStream;
    215217    delete fMuxGui;
    216218#endif
     
    359361
    360362    // lock mutex
    361     Lock("UpdateGui");
     363    LockUpdate("UpdateGui");
    362364
    363365    TGText &txt=*fGui->GetText();
     
    387389
    388390    // release mutex
    389     UnLock("UpdateGui");
     391    UnLockUpdate("UpdateGui");
     392}
     393
     394void MLog::LockUpdate(const char *msg)
     395{
     396#ifdef _REENTRANT
     397    if (fMuxGui->Lock()==13)
     398        Error("LockUpdate", "%s - mutex is already locked by this thread\n", msg);
     399#endif
     400}
     401
     402void MLog::UnLockUpdate(const char *msg)
     403{
     404#ifdef _REENTRANT
     405    if (fMuxGui->UnLock()==13)
     406        Error("UnLockUpdate", "%s - tried to unlock mutex locked by other thread\n", msg);
     407#endif
    390408}
    391409
     
    393411{
    394412#ifdef _REENTRANT
    395     if (fMuxGui->Lock()==13)
     413    if (fMuxStream->Lock()==13)
    396414        Error("Lock", "%s - mutex is already locked by this thread\n", msg);
    397415#endif
     
    401419{
    402420#ifdef _REENTRANT
    403     if (fMuxGui->UnLock()==13)
     421    if (fMuxStream->UnLock()==13)
    404422        Error("UnLock", "%s - tried to unlock mutex locked by other thread\n", msg);
    405423#endif
     
    412430int MLog::sync()
    413431{
    414     Lock("sync");
     432    LockUpdate("sync");
    415433    WriteBuffer();
    416     UnLock("sync");
     434    UnLockUpdate("sync");
    417435
    418436    if (fDevice&eStdout)
     
    448466    if (fOutputLevel <= fDebugLevel)
    449467    {
    450         Lock("overflow");
     468        LockUpdate("overflow");
    451469
    452470        *fPPtr++ = (char)i;
     
    455473            WriteBuffer();
    456474
    457         UnLock("overflow");
     475        UnLockUpdate("overflow");
    458476    }
    459477
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r3927 r3957  
    7171#ifdef _REENTRANT
    7272    TMutex *fMuxGui;          //! Mutex locking access of TGListBox
     73    TMutex *fMuxStream;       //! Mutex locking access to streaming
    7374#endif
    7475
     
    102103    ~MLog();
    103104
    104     void Lock(const char *msg);
    105     void UnLock(const char *msg);
     105    void LockUpdate(const char *msg);
     106    void UnLockUpdate(const char *msg);
     107
     108    void Lock(const char *msg="");
     109    void UnLock(const char *msg="");
    106110
    107111    void EnableDirectGui()  { fIsDirectGui = kTRUE; }
Note: See TracChangeset for help on using the changeset viewer.