qemu/util/qemu-thread-common.h
Markus Armbruster b7d89466dd Clean up includes
Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes, with the changes
to the following files manually reverted:

    contrib/libvhost-user/libvhost-user-glib.h
    contrib/libvhost-user/libvhost-user.c
    contrib/libvhost-user/libvhost-user.h
    linux-user/mips64/cpu_loop.c
    linux-user/mips64/signal.c
    linux-user/sparc64/cpu_loop.c
    linux-user/sparc64/signal.c
    linux-user/x86_64/cpu_loop.c
    linux-user/x86_64/signal.c
    target/s390x/gen-features.c
    tests/migration/s390x/a-b-bios.c
    tests/test-rcu-simpleq.c
    tests/test-rcu-tailq.c

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181204172535.2799-1-armbru@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Acked-by: Yuval Shaia <yuval.shaia@oracle.com>
Acked-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
2018-12-20 10:29:08 +01:00

55 lines
1.2 KiB
C

/*
* Common qemu-thread implementation header file.
*
* Copyright Red Hat, Inc. 2018
*
* Authors:
* Peter Xu <peterx@redhat.com>,
*
* 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 "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);
}
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);
}
#endif