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>
This commit is contained in:
Harsh Prateek Bora 2012-06-08 03:20:42 +05:30 committed by Stefan Hajnoczi
parent 8e0fdce32d
commit 0d665005c7

View 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,