| 296 | | -- mWriteLockLevel; |
|---|
| 297 | | if (mWriteLockLevel == 0) |
|---|
| 298 | | { |
|---|
| 299 | | Assert (mSelfReadLockCount == 0 |
|---|
| 300 | | /* mixed unlockWrite()/unlockRead() order? */); |
|---|
| 301 | | |
|---|
| 302 | | mWriteLockThread = NIL_RTNATIVETHREAD; |
|---|
| 303 | | |
|---|
| 304 | | /* no write locks, let writers go if there are any (top priority), |
|---|
| 305 | | * otherwise let readers go if there are any */ |
|---|
| 306 | | if (mWriteLockPending != 0) |
|---|
| 307 | | RTSemEventSignal (mGoWriteSem); |
|---|
| 308 | | else if (mReadLockCount != 0) |
|---|
| 309 | | RTSemEventMultiSignal (mGoReadSem); |
|---|
| | 298 | Assert (mWriteLockThread == threadSelf |
|---|
| | 299 | /* unlockWrite() w/o preceding lockWrite()? */); |
|---|
| | 300 | if (mWriteLockThread == threadSelf) |
|---|
| | 301 | { |
|---|
| | 302 | -- mWriteLockLevel; |
|---|
| | 303 | if (mWriteLockLevel == 0) |
|---|
| | 304 | { |
|---|
| | 305 | Assert (mSelfReadLockCount == 0 |
|---|
| | 306 | /* mixed unlockWrite()/unlockRead() order? */); |
|---|
| | 307 | |
|---|
| | 308 | mWriteLockThread = NIL_RTNATIVETHREAD; |
|---|
| | 309 | |
|---|
| | 310 | /* no write locks, let writers go if there are any (top priority), |
|---|
| | 311 | * otherwise let readers go if there are any */ |
|---|
| | 312 | if (mWriteLockPending != 0) |
|---|
| | 313 | RTSemEventSignal (mGoWriteSem); |
|---|
| | 314 | else if (mReadLockCount != 0) |
|---|
| | 315 | RTSemEventMultiSignal (mGoReadSem); |
|---|