- Timestamp:
- Jun 29, 2009, 11:49:20 PM (16 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/thread/qwaitcondition_os2.cpp
r63 r66 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** Contact: Qt Software Information ([email protected]) 5 6 5 7 ** 6 8 ** This file is part of the QtCore module of the Qt Toolkit. … … 46 48 #include "qlist.h" 47 49 #include "qalgorithms.h" 48 #include "qt_ windows.h"50 #include "qt_.h" 49 51 50 52 #ifndef QT_NO_THREAD 51 53 52 #define Q_MUTEX_T void*53 54 #include <private/qmutex_p.h> 54 55 #include <private/qreadwritelock_p.h> … … 65 66 inline QWaitConditionEvent() : priority(0), wokenUp(false) 66 67 { 67 QT_WA ({ 68 event = CreateEvent(NULL, TRUE, FALSE, NULL); 69 }, { 70 event = CreateEventA(NULL, TRUE, FALSE, NULL); 71 }); 72 } 73 inline ~QWaitConditionEvent() { CloseHandle(event); } 68 event = NULLHANDLE; 69 DosCreateEventSem(NULL, &event, 0, FALSE); 70 } 71 inline ~QWaitConditionEvent() { DosCloseEventSem(event); } 74 72 int priority; 75 73 bool wokenUp; 76 H ANDLEevent;74 H event; 77 75 }; 78 76 … … 96 94 QWaitConditionEvent *wce = 97 95 freeQueue.isEmpty() ? new QWaitConditionEvent : freeQueue.takeFirst(); 98 wce->priority = GetThreadPriority(GetCurrentThread()); 96 97 PTIB ptib; 98 DosGetInfoBlocks(&ptib, NULL); 99 wce->priority = ptib->tib_ptib2->tib2_ulpri; 100 99 101 wce->wokenUp = false; 100 102 … … 116 118 // wait for the event 117 119 bool ret = false; 118 switch (WaitForSingleObject(wce->event, time)) { 119 default: break; 120 121 case WAIT_OBJECT_0: 120 APIRET rc = DosWaitEventSem(wce->event, time); 121 if (rc == NO_ERROR) 122 122 ret = true; 123 break; 124 } 123 125 124 return ret; 126 125 } … … 132 131 // remove 'wce' from the queue 133 132 queue.removeAll(wce); 134 ResetEvent(wce->event); 133 ULONG posts; 134 DosResetEventSem(wce->event, &posts); 135 135 freeQueue.append(wce); 136 136 … … 138 138 if (!ret && wce->wokenUp && !queue.isEmpty()) { 139 139 QWaitConditionEvent *other = queue.first(); 140 SetEvent(other->event);140 (other->event); 141 141 other->wokenUp = true; 142 142 } … … 217 217 if (current->wokenUp) 218 218 continue; 219 SetEvent(current->event);219 (current->event); 220 220 current->wokenUp = true; 221 221 break; … … 229 229 for (int i = 0; i < d->queue.size(); ++i) { 230 230 QWaitConditionEvent *current = d->queue.at(i); 231 SetEvent(current->event);231 (current->event); 232 232 current->wokenUp = true; 233 233 } … … 235 235 236 236 QT_END_NAMESPACE 237 237 238 #endif // QT_NO_THREAD
Note:
See TracChangeset
for help on using the changeset viewer.