| 2259 | } |
| 2260 | |
| 2261 | static bool leaveFastMutex(FAST_MUTEX* lpMutex) |
| 2262 | { |
| 2263 | volatile FAST_MUTEX_SHARED_SECTION* lpSect = lpMutex->lpSharedInfo; |
| 2264 | |
| 2265 | lockSharedSection(lpSect, lpMutex->lSpinCount); |
| 2266 | if (lpSect->lAvailable >= 1) |
| 2267 | { |
| 2268 | unlockSharedSection(lpSect); |
| 2269 | SetLastError(ERROR_INVALID_PARAMETER); |
| 2270 | return false; |
| 2271 | } |
| 2272 | lpSect->lAvailable++; |
| 2273 | if (lpSect->lThreadsWaiting) |
| 2274 | SetEvent(lpMutex->hEvent); |
| 2275 | fb_assert(lpSect->lOwnerPID == pid); |
| 2276 | lpSect->lOwnerPID = -lpSect->lOwnerPID; |
| 2277 | #ifdef DEV_BUILD |
| 2278 | fb_assert(lpSect->lThreadId == GetCurrentThreadId()); |
| 2279 | lpSect->lThreadId = -lpSect->lThreadId; |
| 2280 | #endif |
| 2281 | unlockSharedSection(lpSect); |
| 2282 | |
| 2283 | return true; |
| 2284 | } |
| 2285 | |
| 2286 | static inline void deleteFastMutex(FAST_MUTEX* lpMutex) |
| 2287 | { |
no test coverage detected