mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
migration: Use cmpxchg correctly
cmpxchg returns the old value Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
61964c23e5
commit
a5c17b5f68
1 changed files with 1 additions and 1 deletions
|
@ -509,7 +509,7 @@ void qmp_migrate_set_parameters(bool has_compress_level,
|
||||||
|
|
||||||
static void migrate_set_state(MigrationState *s, int old_state, int new_state)
|
static void migrate_set_state(MigrationState *s, int old_state, int new_state)
|
||||||
{
|
{
|
||||||
if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) {
|
if (atomic_cmpxchg(&s->state, old_state, new_state) == old_state) {
|
||||||
trace_migrate_set_state(new_state);
|
trace_migrate_set_state(new_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue