13
0

Use signed int for atomic operations -- #8314

This commit is contained in:
Robin Gareus 2020-07-16 16:13:21 +02:00
parent baa8cd1b52
commit 6d950d15ba
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -82,7 +82,7 @@ public:
push_back (T const& data)
{
cell_t* cell;
guint pos = g_atomic_int_get (&_enqueue_pos);
gint pos = g_atomic_int_get (&_enqueue_pos);
for (;;) {
cell = &_buffer[pos & _buffer_mask];
guint seq = g_atomic_int_get (&cell->_sequence);
@ -108,7 +108,7 @@ public:
pop_front (T& data)
{
cell_t* cell;
guint pos = g_atomic_int_get (&_dequeue_pos);
gint pos = g_atomic_int_get (&_dequeue_pos);
for (;;) {
cell = &_buffer[pos & _buffer_mask];
guint seq = g_atomic_int_get (&cell->_sequence);
@ -138,8 +138,8 @@ private:
cell_t* _buffer;
size_t _buffer_mask;
volatile guint _enqueue_pos;
volatile guint _dequeue_pos;
volatile gint _enqueue_pos;
volatile gint _dequeue_pos;
};
} /* end namespace */