Changeset 4253 for trunk/MagicSoft


Ignore:
Timestamp:
06/01/04 16:24:08 (20 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

    r3957 r4253  
    361361
    362362    // lock mutex
    363     LockUpdate("UpdateGui");
     363    if (!LockUpdate("UpdateGui"))
     364    {
     365        Warning("UpdateGui", "Execution skipped");
     366        return;
     367    }
    364368
    365369    TGText &txt=*fGui->GetText();
     
    392396}
    393397
    394 void MLog::LockUpdate(const char *msg)
     398bool MLog::LockUpdate(const char *msg)
    395399{
    396400#ifdef _REENTRANT
    397401    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
     410bool MLog::UnLockUpdate(const char *msg)
    403411{
    404412#ifdef _REENTRANT
    405413    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
     422bool MLog::Lock(const char *msg)
    411423{
    412424#ifdef _REENTRANT
    413425    if (fMuxStream->Lock()==13)
     426    {
    414427        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
     440bool MLog::UnLock(const char *msg)
    419441{
    420442#ifdef _REENTRANT
    421443    if (fMuxStream->UnLock()==13)
     444    {
    422445        Error("UnLock", "%s - tried to unlock mutex locked by other thread\n", msg);
     446        return false;
     447    }
     448    return true;
    423449#endif
    424450}
     
    430456int MLog::sync()
    431457{
    432     LockUpdate("sync");
     458    if (!LockUpdate("sync"))
     459        usleep(1);
    433460    WriteBuffer();
    434461    UnLockUpdate("sync");
     
    466493    if (fOutputLevel <= fDebugLevel)
    467494    {
    468         LockUpdate("overflow");
     495        if (!LockUpdate("overflow"))
     496            usleep(1);
    469497
    470498        *fPPtr++ = (char)i;
  • trunk/MagicSoft/Mars/mbase/MLog.h

    r3957 r4253  
    103103    ~MLog();
    104104
    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="");
     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="");
    110110
    111111    void EnableDirectGui()  { fIsDirectGui = kTRUE; }
Note: See TracChangeset for help on using the changeset viewer.