summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarsh Prateek Bora <harsh@linux.vnet.ibm.com>2012-06-08 03:20:42 +0530
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2012-06-08 09:32:40 +0100
commit0d665005c7fd3800f1ae590701f60fe7e4c9a57a (patch)
tree91b0e6180699a598e83221da218e4f0129f1ad54
parent8e0fdce32d5d2b2e8a67a30537d169bb263ca5e1 (diff)
downloadhqemu-0d665005c7fd3800f1ae590701f60fe7e4c9a57a.zip
hqemu-0d665005c7fd3800f1ae590701f60fe7e4c9a57a.tar.gz
trace/simple.c: fix deprecated glib2 interface
Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
-rw-r--r--trace/simple.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/trace/simple.c b/trace/simple.c
index 33ae486..b4a3c6e 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -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,
OpenPOWER on IntegriCloud