Import QEMU upstream snapshot d2e570c
Upstream: https://gitlab.com/qemu-project/qemu.git Upstream-Commit: d2e570cc0f97b936902a5b1b86b73c0f5998b475
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Common qemu-thread implementation header file.
|
||||
*
|
||||
* Copyright Red Hat, Inc. 2018
|
||||
*
|
||||
* Authors:
|
||||
* Peter Xu <[email protected]>,
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_THREAD_COMMON_H
|
||||
#define QEMU_THREAD_COMMON_H
|
||||
|
||||
#include "qemu/thread.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "trace.h"
|
||||
|
||||
static inline void qemu_mutex_post_init(QemuMutex *mutex)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_MUTEX
|
||||
mutex->file = NULL;
|
||||
mutex->line = 0;
|
||||
#endif
|
||||
mutex->initialized = true;
|
||||
}
|
||||
|
||||
static inline void qemu_mutex_pre_lock(QemuMutex *mutex,
|
||||
const char *file, int line)
|
||||
{
|
||||
trace_qemu_mutex_lock(mutex, file, line);
|
||||
}
|
||||
|
||||
static inline void qemu_mutex_post_lock(QemuMutex *mutex,
|
||||
const char *file, int line)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_MUTEX
|
||||
mutex->file = file;
|
||||
mutex->line = line;
|
||||
#endif
|
||||
trace_qemu_mutex_locked(mutex, file, line);
|
||||
if (mutex_is_bql(mutex)) {
|
||||
bql_update_status(true);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void qemu_mutex_pre_unlock(QemuMutex *mutex,
|
||||
const char *file, int line)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_MUTEX
|
||||
mutex->file = NULL;
|
||||
mutex->line = 0;
|
||||
#endif
|
||||
trace_qemu_mutex_unlock(mutex, file, line);
|
||||
if (mutex_is_bql(mutex)) {
|
||||
bql_update_status(false);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user