mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-capture: Use intrinsic atomics rather than g_atomic_*()
Use the intrinsic atomics provided by the compiler, instead of GLib’s wrapper around them. This should work for all modern compilers. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #40
This commit is contained in:
@ -110,7 +110,7 @@ sysprof_capture_cursor_ref (SysprofCaptureCursor *self)
|
||||
assert (self != NULL);
|
||||
assert (self->ref_count > 0);
|
||||
|
||||
g_atomic_int_inc (&self->ref_count);
|
||||
__atomic_fetch_add (&self->ref_count, 1, __ATOMIC_SEQ_CST);
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ sysprof_capture_cursor_unref (SysprofCaptureCursor *self)
|
||||
assert (self != NULL);
|
||||
assert (self->ref_count > 0);
|
||||
|
||||
if (g_atomic_int_dec_and_test (&self->ref_count))
|
||||
if (__atomic_fetch_sub (&self->ref_count, 1, __ATOMIC_SEQ_CST) == 1)
|
||||
sysprof_capture_cursor_finalize (self);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user