From 8450af0e2950e5a1415e38702d6169cc8a732294 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sat, 6 Aug 2016 12:51:26 +0200 Subject: lib: shm_ap_rbuff: Remove obsolete clean function --- src/lib/shm_ap_rbuff.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/lib/shm_ap_rbuff.c b/src/lib/shm_ap_rbuff.c index 20bea843..e9c51533 100644 --- a/src/lib/shm_ap_rbuff.c +++ b/src/lib/shm_ap_rbuff.c @@ -52,9 +52,6 @@ #define shm_rbuff_empty(rb) (*rb->ptr_head == *rb->ptr_tail) #define head_el_ptr(rb) (rb->shm_base + *rb->ptr_head) #define tail_el_ptr(rb) (rb->shm_base + *rb->ptr_tail) -#define clean_sdus(rb) \ - while (!shm_rbuff_empty(rb) && tail_el_ptr(rb)->port_id < 0) \ - *rb->ptr_tail = (*rb->ptr_tail + 1) & (SHM_BUFFER_SIZE -1); \ struct shm_ap_rbuff { struct rb_entry * shm_base; /* start of entry */ @@ -316,8 +313,6 @@ int shm_ap_rbuff_peek(struct shm_ap_rbuff * rb, pthread_mutex_consistent(rb->lock); } - clean_sdus(rb); - while (shm_rbuff_empty(rb)) { if (timeout != NULL) ret = pthread_cond_timedwait(rb->add, @@ -326,8 +321,6 @@ int shm_ap_rbuff_peek(struct shm_ap_rbuff * rb, else ret = pthread_cond_wait(rb->add, rb->lock); - clean_sdus(rb); - if (ret == EOWNERDEAD) { LOG_DBG("Recovering dead mutex."); pthread_mutex_consistent(rb->lock); @@ -361,8 +354,6 @@ struct rb_entry * shm_ap_rbuff_read(struct shm_ap_rbuff * rb) pthread_mutex_consistent(rb->lock); } - clean_sdus(rb); - while (shm_rbuff_empty(rb)) if (pthread_cond_wait(rb->add, rb->lock) == EOWNERDEAD) { LOG_DBG("Recovering dead mutex."); @@ -393,8 +384,6 @@ ssize_t shm_ap_rbuff_read_port(struct shm_ap_rbuff * rb, int port_id) pthread_mutex_consistent(rb->lock); } - clean_sdus(rb); - if (shm_rbuff_empty(rb) || tail_el_ptr(rb)->port_id != port_id) { pthread_mutex_unlock(rb->lock); return -1; @@ -429,8 +418,6 @@ ssize_t shm_ap_rbuff_read_port_b(struct shm_ap_rbuff * rb, ts_add(&abstime, timeout, &abstime); } - clean_sdus(rb); - pthread_cleanup_push((void(*)(void *))pthread_mutex_unlock, (void *) rb->lock); @@ -442,8 +429,6 @@ ssize_t shm_ap_rbuff_read_port_b(struct shm_ap_rbuff * rb, else ret = pthread_cond_wait(rb->del, rb->lock); - clean_sdus(rb); - if (ret == EOWNERDEAD) { LOG_DBG("Recovering dead mutex."); pthread_mutex_consistent(rb->lock); -- cgit v1.2.3