| 493 | |
| 494 | public: |
| 495 | void foreground_lock() { |
| 496 | // lock |
| 497 | foreground_locked.store(true, std::memory_order_release); |
| 498 | |
| 499 | // wait if (unlikely) background locked |
| 500 | wait_while(background_locked); |
| 501 | } |
| 502 | bool background_try_lock() { |
| 503 | while(true) { |
| 504 | // wait if (unlikely) foreground locked |