| 343 | } |
| 344 | |
| 345 | void GlobalRWLock::blockingAstHandler(thread_db* tdbb) |
| 346 | { |
| 347 | SET_TDBB(tdbb); |
| 348 | |
| 349 | COS_TRACE(("(%p)->blockingAst enter", this)); |
| 350 | COS_TRACE(("(%p)->blockingAst readers(%d), blocking(%d), pendingWriters(%d), currentWriter(%d), lck_physical(%d)", |
| 351 | this, readers, blocking, pendingWriters, currentWriter, cachedLock->lck_physical)); |
| 352 | |
| 353 | if (!pendingLock && !currentWriter && !readers) |
| 354 | { |
| 355 | COS_TRACE(("(%p)->Downgrade lock", this)); |
| 356 | LCK_downgrade(tdbb, cachedLock); |
| 357 | fb_assert(!blocking); |
| 358 | if (cachedLock->lck_physical < LCK_read) |
| 359 | invalidate(tdbb); |
| 360 | } |
| 361 | else if (!pendingLock && !currentWriter && readers && cachedLock->lck_physical > LCK_read) |
| 362 | { |
| 363 | COS_TRACE(("(%p)->Convert lock to SR ", this)); |
| 364 | if (!LCK_convert(tdbb, cachedLock, LCK_read, LCK_NO_WAIT)) |
| 365 | { |
| 366 | COS_TRACE(("(%p)->Set blocking", this)); |
| 367 | blocking = true; |
| 368 | } |
| 369 | } |
| 370 | else |
| 371 | { |
| 372 | COS_TRACE(("(%p)->Set blocking", this)); |
| 373 | blocking = true; |
| 374 | } |
| 375 | } |
no test coverage detected