Skip to content
Snippets Groups Projects
Commit 180d30be authored by Alex Bennée's avatar Alex Bennée Committed by Paolo Bonzini
Browse files

replay/replay-internal.c: track holding of replay_lock


This is modelled after the iothread mutex lock. We keep a TLS flag to
indicate when that thread has acquired the lock and assert we don't
double-lock or release when we shouldn't have.

Signed-off-by: default avatarAlex Bennée <alex.bennee@linaro.org>
Tested-by: default avatarPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20180227095237.1060.44661.stgit@pasha-VirtualBox>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 80be169c
No related branches found
No related tags found
No related merge requests found
......@@ -169,6 +169,8 @@ void replay_finish_event(void)
replay_fetch_data_kind();
}
static __thread bool replay_locked;
void replay_mutex_init(void)
{
qemu_mutex_init(&lock);
......@@ -179,13 +181,22 @@ void replay_mutex_destroy(void)
qemu_mutex_destroy(&lock);
}
static bool replay_mutex_locked(void)
{
return replay_locked;
}
void replay_mutex_lock(void)
{
g_assert(!replay_mutex_locked());
qemu_mutex_lock(&lock);
replay_locked = true;
}
void replay_mutex_unlock(void)
{
g_assert(replay_mutex_locked());
replay_locked = false;
qemu_mutex_unlock(&lock);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment