diff options
author | dimitri staessens <[email protected]> | 2017-04-04 20:24:13 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-04-04 21:18:09 +0200 |
commit | 8a2fd3b8efc2de080349c4ab50a314748adc2699 (patch) | |
tree | 0f156ba97df948f3f3f9d7b32fc2188e93a56e43 | |
parent | 9ac91c79e815126aac17891385e0012078e7a88f (diff) | |
download | ouroboros-8a2fd3b8efc2de080349c4ab50a314748adc2699.tar.gz ouroboros-8a2fd3b8efc2de080349c4ab50a314748adc2699.zip |
lib: Fix insertion in lockless rbuff
-rw-r--r-- | src/lib/shm_rbuff_ll.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/shm_rbuff_ll.c b/src/lib/shm_rbuff_ll.c index d777de8b..1e072b21 100644 --- a/src/lib/shm_rbuff_ll.c +++ b/src/lib/shm_rbuff_ll.c @@ -244,14 +244,14 @@ int shm_rbuff_write(struct shm_rbuff * rb, nhead = RB_HEAD; + *(rb->shm_base + nhead) = (ssize_t) idx; + do { ohead = nhead; nhead = (ohead + 1) & ((SHM_BUFFER_SIZE) - 1); nhead = __sync_val_compare_and_swap(rb->head, ohead, nhead); } while (nhead != ohead); - *(rb->shm_base + nhead) = (ssize_t) idx; - if (was_empty) pthread_cond_broadcast(rb->add); |