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:
Philip Withnall
2020-07-01 17:00:36 +01:00
parent b6fb272865
commit 951b46fddf
5 changed files with 22 additions and 19 deletions

View File

@ -973,7 +973,7 @@ sysprof_capture_reader_ref (SysprofCaptureReader *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;
}
@ -984,7 +984,7 @@ sysprof_capture_reader_unref (SysprofCaptureReader *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_reader_finalize (self);
}