|
|
| version 1.8, 2026/02/18 11:41:47 | version 1.8.4.1, 2026/05/05 15:35:28 |
|---|---|
| Line 59 rbuf_init(ringbuf_t *rbuf, int num) | Line 59 rbuf_init(ringbuf_t *rbuf, int num) |
| if (!rbuf) | if (!rbuf) |
| return -1; | return -1; |
| atomic_store_explicit((atomic_int*) &rbuf->rb_head, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &rbuf->rb_head, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &rbuf->rb_tail, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &rbuf->rb_tail, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &rbuf->rb_full, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &rbuf->rb_full, 0, memory_order_release); |
| rbuf->rb_buffer = e_calloc(num, sizeof(struct iovec)); | rbuf->rb_buffer = e_calloc(num, sizeof(struct iovec)); |
| if (!rbuf->rb_buffer) | if (!rbuf->rb_buffer) |
| Line 91 rbuf_free(ringbuf_t *rbuf) | Line 91 rbuf_free(ringbuf_t *rbuf) |
| rbuf->rb_bufnum = 0; | rbuf->rb_bufnum = 0; |
| } | } |
| atomic_store_explicit((atomic_int*) &rbuf->rb_head, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &rbuf->rb_head, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &rbuf->rb_tail, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &rbuf->rb_tail, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &rbuf->rb_full, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &rbuf->rb_full, 0, memory_order_release); |
| } | } |
| /* | /* |
| Line 111 rbuf_purge(ringbuf_t *rbuf) | Line 111 rbuf_purge(ringbuf_t *rbuf) |
| if (rbuf->rb_buffer) | if (rbuf->rb_buffer) |
| memset(rbuf->rb_buffer, 0, rbuf->rb_bufnum * sizeof(struct iovec)); | memset(rbuf->rb_buffer, 0, rbuf->rb_bufnum * sizeof(struct iovec)); |
| atomic_store_explicit((atomic_int*) &rbuf->rb_head, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &rbuf->rb_head, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &rbuf->rb_tail, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &rbuf->rb_tail, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &rbuf->rb_full, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &rbuf->rb_full, 0, memory_order_release); |
| } | } |
| /* | /* |
| Line 262 lrb_init(lrbuf_t *lrb, u_int size) | Line 262 lrb_init(lrbuf_t *lrb, u_int size) |
| if (!lrb) | if (!lrb) |
| return -1; | return -1; |
| atomic_store_explicit((atomic_int*) &lrb->lrb_head, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &lrb->lrb_head, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &lrb->lrb_tail, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &lrb->lrb_tail, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &lrb->lrb_full, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &lrb->lrb_full, 0, memory_order_release); |
| lrb->lrb_data = e_malloc(size); | lrb->lrb_data = e_malloc(size); |
| if (!lrb->lrb_data) | if (!lrb->lrb_data) |
| Line 294 lrb_free(lrbuf_t *lrb) | Line 294 lrb_free(lrbuf_t *lrb) |
| lrb->lrb_size = 0; | lrb->lrb_size = 0; |
| } | } |
| atomic_store_explicit((atomic_int*) &lrb->lrb_head, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &lrb->lrb_head, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &lrb->lrb_tail, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &lrb->lrb_tail, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &lrb->lrb_full, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &lrb->lrb_full, 0, memory_order_release); |
| } | } |
| /* | /* |
| Line 314 lrb_purge(lrbuf_t *lrb) | Line 314 lrb_purge(lrbuf_t *lrb) |
| if (lrb->lrb_data) | if (lrb->lrb_data) |
| memset(lrb->lrb_data, 0, lrb->lrb_size); | memset(lrb->lrb_data, 0, lrb->lrb_size); |
| atomic_store_explicit((atomic_int*) &lrb->lrb_head, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &lrb->lrb_head, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &lrb->lrb_tail, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &lrb->lrb_tail, 0, memory_order_release); |
| atomic_store_explicit((atomic_int*) &lrb->lrb_full, 0, memory_order_relaxed); | atomic_store_explicit((atomic_int*) &lrb->lrb_full, 0, memory_order_release); |
| } | } |
| /* | /* |
| Line 377 lrb_getw(lrbuf_t *lrb, size_t *len) | Line 377 lrb_getw(lrbuf_t *lrb, size_t *len) |
| if (!lrb || !lrb->lrb_data || !lrb->lrb_size) | if (!lrb || !lrb->lrb_data || !lrb->lrb_size) |
| return NULL; | return NULL; |
| h = atomic_load_explicit((atomic_int*) &lrb->lrb_head, memory_order_relaxed); | h = atomic_load_explicit((atomic_int*) &lrb->lrb_head, memory_order_acquire); |
| if (len) | if (len) |
| *len = lrb->lrb_size - h; | *len = lrb->lrb_size - h; |
| Line 417 lrb_enqueue(lrbuf_t *lrb, void *data, size_t len, int | Line 417 lrb_enqueue(lrbuf_t *lrb, void *data, size_t len, int |
| t = atomic_load_explicit((atomic_int*) &lrb->lrb_tail, memory_order_acquire); | t = atomic_load_explicit((atomic_int*) &lrb->lrb_tail, memory_order_acquire); |
| t2 = (t + drop) % lrb->lrb_size; | t2 = (t + drop) % lrb->lrb_size; |
| } | } |
| h = atomic_load_explicit((atomic_int*) &lrb->lrb_head, memory_order_relaxed); | h = atomic_load_explicit((atomic_int*) &lrb->lrb_head, memory_order_acquire); |
| n = lrb->lrb_size - h; | n = lrb->lrb_size - h; |
| if (len < n) { | if (len < n) { |
| if (data) | if (data) |