diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2016-10-26 17:19:56 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-03-31 17:59:48 +0200 |
| commit | a31446a88f7751b763d0af2a3d92c9e0887faa61 (patch) | |
| tree | 91a7bcf0fd64b1fe3d0ef581d338fdeb2993b758 /lib/memory.h | |
| parent | 899a4fd2a14bf51b8a37e6d0fadd5dbf9395b427 (diff) | |
lib: memtypes: restore atomicity
the original version of this code already used _Atomic and atomic_*().
Restore this functionality for future multithreading.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/memory.h')
| -rw-r--r-- | lib/memory.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/memory.h b/lib/memory.h index 477a6162dc..284a1b13c5 100644 --- a/lib/memory.h +++ b/lib/memory.h @@ -18,6 +18,7 @@ #define _QUAGGA_MEMORY_H #include <stdlib.h> +#include <frratomic.h> #define array_size(ar) (sizeof(ar) / sizeof(ar[0])) @@ -26,8 +27,8 @@ struct memtype { struct memtype *next, **ref; const char *name; - size_t n_alloc; - size_t size; + _Atomic size_t n_alloc; + _Atomic size_t size; }; struct memgroup |
