diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-10-06 17:13:32 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-10-06 17:13:32 +0200 |
commit | e351576c01e5f705ed21289aa48f23f345d7c7e1 (patch) | |
tree | 671b0562b1b0f99e5565541315d2aa22e4b13955 | |
parent | a4672940dc1effa40d2debf046c98708a831e928 (diff) | |
parent | aa0eac4f93b80537d02123715842d594a8ff3aad (diff) | |
download | ouroboros-e351576c01e5f705ed21289aa48f23f345d7c7e1.tar.gz ouroboros-e351576c01e5f705ed21289aa48f23f345d7c7e1.zip |
Merged in dstaesse/ouroboros/be-fix-shutdown (pull request #256)
lib: Fix shutdown with pending SDUs
-rw-r--r-- | include/ouroboros/shm_ap_rbuff.h | 2 | ||||
-rw-r--r-- | src/lib/dev.c | 2 | ||||
-rw-r--r-- | src/lib/shm_ap_rbuff.c | 4 |
3 files changed, 5 insertions, 3 deletions
diff --git a/include/ouroboros/shm_ap_rbuff.h b/include/ouroboros/shm_ap_rbuff.h index 89d9876d..dd82c01c 100644 --- a/include/ouroboros/shm_ap_rbuff.h +++ b/include/ouroboros/shm_ap_rbuff.h @@ -49,7 +49,7 @@ int shm_ap_rbuff_write(struct shm_ap_rbuff * rb, struct rb_entry * shm_ap_rbuff_read(struct shm_ap_rbuff * rb); -int shm_ap_rbuff_peek_idx(struct shm_ap_rbuff * rb); +int shm_ap_rbuff_pop_idx(struct shm_ap_rbuff * rb); int shm_ap_rbuff_peek_b(struct shm_ap_rbuff * rb, bool * set, diff --git a/src/lib/dev.c b/src/lib/dev.c index 8e1ee342..8556d6e2 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -255,7 +255,7 @@ void ap_fini() pthread_rwlock_wrlock(&ai.data_lock); /* remove all remaining sdus */ - while ((i = shm_ap_rbuff_peek_idx(ai.rb)) >= 0) + while ((i = shm_ap_rbuff_pop_idx(ai.rb)) >= 0) shm_rdrbuff_remove(ai.rdrb, i); if (ai.fds != NULL) diff --git a/src/lib/shm_ap_rbuff.c b/src/lib/shm_ap_rbuff.c index 184a1bf2..acbc81a6 100644 --- a/src/lib/shm_ap_rbuff.c +++ b/src/lib/shm_ap_rbuff.c @@ -294,7 +294,7 @@ int shm_ap_rbuff_write(struct shm_ap_rbuff * rb, struct rb_entry * e) return 0; } -int shm_ap_rbuff_peek_idx(struct shm_ap_rbuff * rb) +int shm_ap_rbuff_pop_idx(struct shm_ap_rbuff * rb) { int ret = 0; @@ -315,6 +315,8 @@ int shm_ap_rbuff_peek_idx(struct shm_ap_rbuff * rb) ret = tail_el_ptr(rb)->index; + *rb->ptr_head = (*rb->ptr_head + 1) & (SHM_BUFFER_SIZE -1); + pthread_mutex_unlock(rb->lock); return ret; |