| 763 | } |
| 764 | |
| 765 | void WindowsEnv::BackgroundThreadMain() { |
| 766 | while (true) { |
| 767 | background_work_mutex_.Lock(); |
| 768 | |
| 769 | // Wait until there is work to be done. |
| 770 | while (background_work_queue_.empty()) { |
| 771 | background_work_cv_.Wait(); |
| 772 | } |
| 773 | |
| 774 | assert(!background_work_queue_.empty()); |
| 775 | auto background_work_function = background_work_queue_.front().function; |
| 776 | void* background_work_arg = background_work_queue_.front().arg; |
| 777 | background_work_queue_.pop(); |
| 778 | |
| 779 | background_work_mutex_.Unlock(); |
| 780 | background_work_function(background_work_arg); |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | // Wraps an Env instance whose destructor is never created. |
| 785 | // |
no test coverage detected