| 160 | } |
| 161 | |
| 162 | static void host_log_close(void) { |
| 163 | cbm_log_set_sink(NULL); |
| 164 | if (g_host_log_mutex_initialized) { |
| 165 | cbm_mutex_lock(&g_host_log_mutex); |
| 166 | } |
| 167 | FILE *file = g_host_log_file; |
| 168 | g_host_log_file = NULL; |
| 169 | if (file) { |
| 170 | (void)fclose(file); |
| 171 | } |
| 172 | if (g_host_log_mutex_initialized) { |
| 173 | cbm_mutex_unlock(&g_host_log_mutex); |
| 174 | cbm_mutex_destroy(&g_host_log_mutex); |
| 175 | g_host_log_mutex_initialized = false; |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | static uint64_t host_deadline_after(uint32_t timeout_ms) { |
| 180 | uint64_t now = cbm_now_ms(); |
no test coverage detected