Skip to content

Commit

Permalink
replay: flush events when exiting
Browse files Browse the repository at this point in the history
This patch adds events processing when emulation finishes instead
of just cleaning the queue. Now the bdrv coroutines will be in consistent
state when emulator closes. It allows correct polling of the block layer
at exit.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Message-Id: <20180912081859.3228.79735.stgit@pasha-VirtualBox>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Dovgalyuk authored and bonzini committed Oct 2, 2018
1 parent 0c08185 commit d873fe0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
14 changes: 1 addition & 13 deletions replay/replay-events.c
Expand Up @@ -94,18 +94,6 @@ void replay_disable_events(void)
}
}

void replay_clear_events(void)
{
g_assert(replay_mutex_locked());

while (!QTAILQ_EMPTY(&events_list)) {
Event *event = QTAILQ_FIRST(&events_list);
QTAILQ_REMOVE(&events_list, event, events);

g_free(event);
}
}

/*! Adds specified async event to the queue */
void replay_add_event(ReplayAsyncEventKind event_kind,
void *opaque,
Expand Down Expand Up @@ -308,7 +296,7 @@ void replay_init_events(void)
void replay_finish_events(void)
{
events_enabled = false;
replay_clear_events();
replay_flush_events();
}

bool replay_events_enabled(void)
Expand Down
2 changes: 0 additions & 2 deletions replay/replay-internal.h
Expand Up @@ -142,8 +142,6 @@ void replay_init_events(void);
void replay_finish_events(void);
/*! Flushes events queue */
void replay_flush_events(void);
/*! Clears events list before loading new VM state */
void replay_clear_events(void);
/*! Returns true if there are any unsaved events in the queue */
bool replay_has_events(void);
/*! Saves events from queue into the file */
Expand Down

0 comments on commit d873fe0

Please sign in to comment.