summaryrefslogtreecommitdiffstats
path: root/cpu.c
diff options
context:
space:
mode:
authorRichard Henderson2022-04-17 20:29:47 +0200
committerRichard Henderson2022-04-20 19:51:11 +0200
commitc60f599bcb9bf9256eb87c1c60add55d23f76de3 (patch)
tree826787db9c46fdd8c85f1e766e789ae186312e23 /cpu.c
parentutil/log: Move qemu_log_lock, qemu_log_unlock out of line (diff)
downloadqemu-c60f599bcb9bf9256eb87c1c60add55d23f76de3.tar.gz
qemu-c60f599bcb9bf9256eb87c1c60add55d23f76de3.tar.xz
qemu-c60f599bcb9bf9256eb87c1c60add55d23f76de3.zip
util/log: Rename qemu_log_lock to qemu_log_trylock
This function can fail, which makes it more like ftrylockfile or pthread_mutex_trylock than flockfile or pthread_mutex_lock, so rename it. To closer match the other trylock functions, release rcu_read_lock along the failure path, so that qemu_log_unlock need not be called on failure. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220417183019.755276-8-richard.henderson@linaro.org>
Diffstat (limited to 'cpu.c')
-rw-r--r--cpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cpu.c b/cpu.c
index 0fef70e18e..9db144761d 100644
--- a/cpu.c
+++ b/cpu.c
@@ -399,7 +399,7 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...)
fprintf(stderr, "\n");
cpu_dump_state(cpu, stderr, CPU_DUMP_FPU | CPU_DUMP_CCOP);
if (qemu_log_separate()) {
- FILE *logfile = qemu_log_lock();
+ FILE *logfile = qemu_log_trylock();
qemu_log("qemu: fatal: ");
qemu_log_vprintf(fmt, ap2);
qemu_log("\n");