| 558 | } |
| 559 | |
| 560 | static inline bool ConditionalAcquireContentLock(volatile BufferDesc *buf, |
| 561 | LWLockMode mode) |
| 562 | { |
| 563 | #ifdef MPROTECT_BUFFERS |
| 564 | const bool newAcquisition = |
| 565 | !LWLockHeldByMe(BufferDescriptorGetContentLock(buf)); |
| 566 | |
| 567 | if (LWLockConditionalAcquire(BufferDescriptorGetContentLock(buf), mode)) |
| 568 | { |
| 569 | /* new acquisition of lock, allow read/write memory access */ |
| 570 | if (newAcquisition) |
| 571 | BufferMProtect( buf, PROT_READ | PROT_WRITE ); |
| 572 | return true; |
| 573 | } |
| 574 | return false; |
| 575 | #else |
| 576 | return LWLockConditionalAcquire(BufferDescriptorGetContentLock(buf), mode); |
| 577 | #endif |
| 578 | } |
| 579 | |
| 580 | /* |
| 581 | * Implementation of PrefetchBuffer() for shared buffers. |
no test coverage detected