Timestamp:
Jul 11, 2009, 1:51:36 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

QMutex: OS/2: Use an event semaphore since the rest is done through atomic ops (a copy/paste bug from Qt3).

Location:
trunk/src/corelib/thread
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/thread/qmutex_os2.cpp

    r65 r82  
    5151    : recursive(mode == QMutex::Recursive), contenders(0), lastSpinCount(0), owner(0), count(0)
    5252{
    53     APIRET rc = DosCreateMutexSem(NULL, &mtx, 0, FALSE);
     53    APIRET rc = DosCreate, FALSE);
    5454    if (rc != NO_ERROR) {
    55         mtx = NULLHANDLE;
    56         qWarning("QMutexPrivate::QMutexPrivate: DosCreateMutexSem returned %lu", rc);
     55        = NULLHANDLE;
     56        qWarning("QMutexPrivate::QMutexPrivate: DosCreateSem returned %lu", rc);
    5757    }
    5858}
     
    6060QMutexPrivate::~QMutexPrivate()
    6161{
    62     APIRET rc = DosCloseMutexSem(mtx);
     62    APIRET rc = DosClose);
    6363    if (rc != NO_ERROR)
    64         qWarning("QMutexPrivate::QMutexPrivate: DosCloseMutexSem returned %lu", rc);
    65     mtx = NULLHANDLE;
     64        qWarning("QMutexPrivate::QMutexPrivate: DosCloseSem returned %lu", rc);
     65    = NULLHANDLE;
    6666}
    6767
    6868bool QMutexPrivate::wait(int timeout)
    6969{
    70     APIRET rc = DosRequestMutexSem(mtx, timeout < 0 ? SEM_INDEFINITE_WAIT : timeout);
     70    APIRET rc = Dos, timeout < 0 ? SEM_INDEFINITE_WAIT : timeout);
    7171    switch (rc) {
    7272        case NO_ERROR:
    7373            return true;
    74         case ERROR_SEM_OWNER_DIED:
    75             qWarning("QMutexPrivate::wait: mutex owner terminated while holding it!");
     74        case ERROR_TIMEOUT:
    7675            break;
    7776        default:
    78             qWarning("QMutexPrivate::wait: DosRequestMutexSem returned %lu", rc);
     77            qWarning("QMutexPrivate::wait: DosSem returned %lu", rc);
    7978            break;
    8079    }
     
    8584void QMutexPrivate::wakeUp()
    8685{
    87     APIRET rc = DosReleaseMutexSem(mtx);
     86    APIRET rc = Dos);
    8887    if (rc != NO_ERROR) {
    89         qWarning("QMutexPrivate::wait: DosReleaseMutexSem returned %lu", rc);
     88        qWarning("QMutexPrivate::wait: DosSem returned %lu", rc);
    9089    }
    9190}
  • trunk/src/corelib/thread/qmutex_p.h

    r65 r82  
    8686    HANDLE event;
    8787#elif defined(Q_OS_OS2)
    88     HMTX mtx;
     88    H;
    8989#endif
    9090};
Note: See TracChangeset for help on using the changeset viewer.