1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

use proper enum type for atomic state

This commit is contained in:
Steffen Vogel 2017-05-14 11:36:14 +02:00
parent e95b562c71
commit 44669a748d
2 changed files with 3 additions and 3 deletions

View file

@ -56,7 +56,7 @@ struct queue_cell {
struct queue {
cacheline_pad_t _pad0; /**< Shared area: all threads read */
atomic_size_t state;
_Atomic enum state state;
struct memtype *mem;
size_t buffer_mask;

View file

@ -188,8 +188,8 @@ int queue_pull_many(struct queue *q, void *ptr[], size_t cnt)
int queue_close(struct queue *q)
{
size_t expected = STATE_INITIALIZED;
if (atomic_compare_exchange_weak_explicit(&q->state, &expected, STATE_STOPPED, memory_order_relaxed, memory_order_relaxed)) {
enum state expected = STATE_INITIALIZED;
if (atomic_compare_exchange_weak_explicit(&q->state, &expected, STATE_STOPPED, memory_order_relaxed, memory_order_relaxed))
return 0;
return -1;