| 813 | } |
| 814 | |
| 815 | void PosixEnv::BackgroundThreadMain() { |
| 816 | while (true) { |
| 817 | background_work_mutex_.Lock(); |
| 818 | |
| 819 | // Wait until there is work to be done. |
| 820 | while (background_work_queue_.empty()) { |
| 821 | background_work_cv_.Wait(); |
| 822 | } |
| 823 | |
| 824 | assert(!background_work_queue_.empty()); |
| 825 | auto background_work_function = background_work_queue_.front().function; |
| 826 | void* background_work_arg = background_work_queue_.front().arg; |
| 827 | background_work_queue_.pop(); |
| 828 | |
| 829 | background_work_mutex_.Unlock(); |
| 830 | background_work_function(background_work_arg); |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | namespace { |
| 835 |
no test coverage detected