| 147 | } |
| 148 | |
| 149 | static void host_log_close(void) { |
| 150 | cbm_log_set_sink(NULL); |
| 151 | if (g_host_log_mutex_initialized) { |
| 152 | cbm_mutex_lock(&g_host_log_mutex); |
| 153 | } |
| 154 | FILE *file = g_host_log_file; |
| 155 | g_host_log_file = NULL; |
| 156 | if (file) { |
| 157 | (void)fclose(file); |
| 158 | } |
| 159 | if (g_host_log_mutex_initialized) { |
| 160 | cbm_mutex_unlock(&g_host_log_mutex); |
| 161 | cbm_mutex_destroy(&g_host_log_mutex); |
| 162 | g_host_log_mutex_initialized = false; |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | static uint64_t host_deadline_after(uint32_t timeout_ms) { |
| 167 | uint64_t now = cbm_now_ms(); |
no test coverage detected