@@ -205,15 +205,11 @@ static GThread *_thread_new(const gchar *name, GThreadFunc func, gpointer data)
return thread;
}
-static void read_guest_mem(void)
+static void wait_for_fds(void)
{
- uint32_t *guest_mem;
gint64 end_time;
- int i, j;
- size_t size;
g_mutex_lock(data_mutex);
-
end_time = _get_time() + 5 * G_TIME_SPAN_SECOND;
while (!fds_num) {
if (!_cond_wait_until(data_cond, data_mutex, end_time)) {
@@ -227,6 +223,17 @@ static void read_guest_mem(void)
g_assert_cmpint(fds_num, >, 0);
g_assert_cmpint(fds_num, ==, memory.nregions);
+ g_mutex_unlock(data_mutex);
+}
+
+static void read_guest_mem(void)
+{
+ uint32_t *guest_mem;
+ int i, j;
+ size_t size;
+
+ wait_for_fds();
+
/* iterate all regions */
for (i = 0; i < fds_num; i++) {