]> git.proxmox.com Git - qemu.git/blobdiff - trace/simple.c
trace/simple.c: fix deprecated glib2 interface
[qemu.git] / trace / simple.c
index 33ae48696d194d7890152cf81ca3db619f3c494e..b4a3c6e9501db07a541f8e5cf98cf359adfa57ec 100644 (file)
@@ -161,8 +161,11 @@ static void trace(TraceEventID event, uint64_t x1, uint64_t x2, uint64_t x3,
     }
 
     timestamp = get_clock();
-
+#if GLIB_CHECK_VERSION(2, 30, 0)
+    idx = g_atomic_int_add((gint *)&trace_idx, 1) % TRACE_BUF_LEN;
+#else
     idx = g_atomic_int_exchange_and_add((gint *)&trace_idx, 1) % TRACE_BUF_LEN;
+#endif
     trace_buf[idx] = (TraceRecord){
         .event = event,
         .timestamp_ns = timestamp,