mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
lib: use stdatomic.h for memory barriers
C11 gives us APIs for fencing logic. Use that instead of a a long, per-architecture, hand curated list of definitions.
This commit is contained in:
@ -42,6 +42,7 @@
|
||||
#include <errno.h>
|
||||
#include <gio/gio.h>
|
||||
#include <gio/gunixfdlist.h>
|
||||
#include <stdatomic.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
@ -54,8 +55,6 @@
|
||||
|
||||
#include "sp-perf-counter.h"
|
||||
|
||||
#include "util.h"
|
||||
|
||||
/*
|
||||
* Number of pages to map for the ring buffer. We map one additional buffer
|
||||
* at the beginning for header information to communicate with perf.
|
||||
@ -227,7 +226,7 @@ sp_perf_counter_flush (SpPerfCounter *self,
|
||||
tail = info->tail;
|
||||
head = info->map->data_head;
|
||||
|
||||
read_barrier ();
|
||||
atomic_thread_fence (memory_order_acquire);
|
||||
|
||||
if (head < tail)
|
||||
tail = head;
|
||||
|
||||
Reference in New Issue
Block a user