[sysprof] lib: use stdatomic.h for memory barriers



commit 1b89cc58cf1de959ace6492dad37059f2502f7b9
Author: Ray Strode <rstrode redhat com>
Date:   Tue Aug 23 16:52:29 2016 -0400

    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.

 lib/Makefile.am         |    1 -
 lib/sp-callgraph-view.c |    2 --
 lib/sp-perf-counter.c   |    5 ++---
 lib/util/binfile.c      |    1 -
 lib/util/util.h         |   44 --------------------------------------------
 5 files changed, 2 insertions(+), 51 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d69694e..2b9d473 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -20,7 +20,6 @@ libutil_la_SOURCES = \
        util/elfparser.h \
        util/stackstash.c \
        util/stackstash.h \
-       util/util.h \
        $(NULL)
 libutil_la_CFLAGS = \
        -I$(srcdir)/util \
diff --git a/lib/sp-callgraph-view.c b/lib/sp-callgraph-view.c
index 30f2743..2260d0b 100644
--- a/lib/sp-callgraph-view.c
+++ b/lib/sp-callgraph-view.c
@@ -41,8 +41,6 @@
 #include "sp-callgraph-view.h"
 #include "sp-cell-renderer-percent.h"
 
-#include "util.h"
-
 typedef struct
 {
   SpCallgraphProfile  *profile;
diff --git a/lib/sp-perf-counter.c b/lib/sp-perf-counter.c
index f2cdc59..bd7315b 100644
--- a/lib/sp-perf-counter.c
+++ b/lib/sp-perf-counter.c
@@ -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;
diff --git a/lib/util/binfile.c b/lib/util/binfile.c
index be181c3..a30c088 100644
--- a/lib/util/binfile.c
+++ b/lib/util/binfile.c
@@ -37,7 +37,6 @@
 
 #include "binfile.h"
 #include "elfparser.h"
-#include "util.h"
 
 struct bin_file_t
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]