diff --git a/include/villas/queue.h b/include/villas/queue.h index edf8efa59..393370c12 100644 --- a/include/villas/queue.h +++ b/include/villas/queue.h @@ -33,11 +33,12 @@ #pragma once +#include + #include #include #include -#include #include #include @@ -47,13 +48,13 @@ struct memory_type; typedef char cacheline_pad_t[CACHELINE_SIZE]; struct queue_cell { - atomic_size_t sequence; + std::atomic sequence; off_t data_off; /**< Pointer relative to the queue struct */ }; /** A lock-free multiple-producer, multiple-consumer (MPMC) queue. */ struct queue { - atomic_state state; + std::atomic state; cacheline_pad_t _pad0; /**< Shared area: all threads read */ @@ -62,11 +63,11 @@ struct queue { cacheline_pad_t _pad1; /**< Producer area: only producers read & write */ - atomic_size_t tail; /**< Queue tail pointer */ + std::atomic tail; /**< Queue tail pointer */ cacheline_pad_t _pad2; /**< Consumer area: only consumers read & write */ - atomic_size_t head; /**< Queue head pointer */ + std::atomic head; /**< Queue head pointer */ cacheline_pad_t _pad3; /**< @todo Why needed? */ }; diff --git a/include/villas/sample.h b/include/villas/sample.h index 52af980a2..b8b3d50ec 100644 --- a/include/villas/sample.h +++ b/include/villas/sample.h @@ -23,12 +23,13 @@ #pragma once +#include + #include #include #include #include -#include #include /* Forward declarations */ @@ -67,7 +68,7 @@ struct sample { struct vlist *signals; /**< The list of signal descriptors. */ - atomic_int refcnt; /**< Reference counter. */ + std::atomic refcnt; /**< Reference counter. */ ptrdiff_t pool_off; /**< This sample belongs to this memory pool (relative pointer). See sample_pool(). */ /** All timestamps are seconds / nano seconds after 1.1.1970 UTC */ diff --git a/include/villas/shmem.h b/include/villas/shmem.h index 7aa491f45..5fa6f500a 100644 --- a/include/villas/shmem.h +++ b/include/villas/shmem.h @@ -63,7 +63,7 @@ struct shmem_dir { /** Main structure representing the shared memory interface. */ struct shmem_int { struct shmem_dir read, write; - atomic_int readers, writers, closed; + std::atomic readers, writers, closed; }; /** Open the shared memory objects and retrieve / initialize the shared data structures. diff --git a/include/villas/signal.h b/include/villas/signal.h index f763f81d1..352bbda6c 100644 --- a/include/villas/signal.h +++ b/include/villas/signal.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include #include @@ -31,8 +33,6 @@ /* "I" defined by complex.h collides with a define in OpenSSL */ #undef I -#include - /* Forward declarations */ struct vlist; struct node; @@ -69,7 +69,7 @@ struct signal { int enabled; - atomic_int refcnt; /**< Reference counter. */ + std::atomic refcnt; /**< Reference counter. */ enum signal_type type; };