Changeset 191 for trunk/src/helpers/except.c
- Timestamp:
- Jul 24, 2002, 11:49:43 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/except.c
r164 r191 117 117 * 118 118 * As a result, you should protect any section of code which 119 * requests a semaphore with the exception handlers. To protect 120 * yourself against thread termination, use must-complete 121 * sections as well (but be careful with those if your code 122 * takes a long time to execute... but then you shouldn't 123 * request a mutex in the first place). 119 * requests a semaphore with the exception handlers. 124 120 * 125 121 * So _whenever_ you request a mutex semaphore, enclose … … 133 129 + { 134 130 + BOOL fSemOwned = FALSE; 135 + ULONG ulNesting = 0;136 131 + 137 + DosEnterMustComplete(&ulNesting);138 132 + TRY_QUIET(excpt1) // or TRY_LOUD 139 133 + { 140 + fSemOwned = !WinRequestMutexSem(hmtx, ...); 141 + if (fSemOwned) 134 + if (fSemOwned = !DosRequestMutexSem(hmtx, ...)) 142 135 + { ... // work on your protected data 143 136 + } … … 147 140 + 148 141 + if (fSemOwned) 149 + {150 142 + // this gets executed always, even if an exception occured 151 143 + DosReleaseMutexSem(hmtx); 152 + fSemOwned = FALSE;153 + }154 + DosExitMustComplete(&ulNesting);155 144 + } // end of your_func 156 145 *
Note:
See TracChangeset
for help on using the changeset viewer.