Changeset 79


Ignore:
Timestamp:
Apr 5, 2006, 9:18:34 PM (19 years ago)
Author:
dmik
Message:

Fixed QCriticalSection implementation on OS/2: it was really stupid to suppose that DosEnterCritSec = EnterCriticalSection w/o reading Win32 API docs and w/o searching for QCriticalSection usage within Qt; now mutex semaphores are used instead.

Location:
trunk/src/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tools/qcriticalsection_p.cpp

    r8 r79  
    4444#endif
    4545
    46 #if defined(Q_WS_WIN)
    4746class QCriticalSectionPrivate
    4847{
     
    5049    QCriticalSectionPrivate() {}
    5150
     51#if defined(Q_WS_WIN)
    5252    CRITICAL_SECTION section;
     53#elif defined(Q_OS_OS2)
     54    HMTX mutex;
     55#endif
    5356};
    54 #endif
    5557
    5658QCriticalSection::QCriticalSection()
    5759{
     60    d = new QCriticalSectionPrivate;
    5861#if defined(Q_WS_WIN)
    59     d = new QCriticalSectionPrivate;
    6062    InitializeCriticalSection( &d->section );
     63#elif defined(Q_OS_OS2)
     64    DosCreateMutexSem( NULL, &d->mutex, 0, FALSE );
    6165#endif
    6266}
     
    6670#if defined(Q_WS_WIN)
    6771    DeleteCriticalSection( &d->section );
     72#elif defined(Q_OS_OS2)
     73    DosCloseMutexSem( d->mutex );
     74#endif
    6875    delete d;
    69 #endif
    7076}
    7177
     
    7581    EnterCriticalSection( &d->section );
    7682#elif defined(Q_OS_OS2)
    77     DosEnterCritSec();
     83    DosRequestMutexSem( d->mutex, SEM_INDEFINITE_WAIT );
    7884#endif
    7985}
     
    8490    LeaveCriticalSection( &d->section );
    8591#elif defined(Q_OS_OS2)
    86     DosExitCritSec();
     92    DosReleaseMutexSem( d->mutex );
    8793#endif
    8894}
  • trunk/src/tools/qcriticalsection_p.h

    r8 r79  
    6161*/
    6262
    63 #if defined(Q_WS_WIN)
    6463class QCriticalSectionPrivate;
    65 #endif
    6664
    6765class QCriticalSection
     
    7371    void leave();
    7472
    75 #if defined(Q_WS_WIN)
    7673private:
    7774    QCriticalSectionPrivate *d;
    78 #endif   
    7975};
    8076
Note: See TracChangeset for help on using the changeset viewer.