summaryrefslogtreecommitdiff
path: root/src/lib/shm_rdrbuff.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-09-01 08:45:52 +0200
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-09-01 08:45:52 +0200
commitf06c381a4e202a1e62ae156d87c0c2545955fc80 (patch)
tree740372c4ac50a314f3f7bdb9eeb40a823f199bfb /src/lib/shm_rdrbuff.c
parent28fe806163bfabd08dcfbe5de7bd84431453c9de (diff)
parent380837a8e9677220f706113b9b34e40a5b40c5d8 (diff)
downloadouroboros-f06c381a4e202a1e62ae156d87c0c2545955fc80.tar.gz
ouroboros-f06c381a4e202a1e62ae156d87c0c2545955fc80.zip
Merged in dstaesse/ouroboros/be-bugfixing (pull request #233)
lib, rdrbuff: Fix fast path lockup
Diffstat (limited to 'src/lib/shm_rdrbuff.c')
-rw-r--r--src/lib/shm_rdrbuff.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c
index 0587a8b9..96f54bd5 100644
--- a/src/lib/shm_rdrbuff.c
+++ b/src/lib/shm_rdrbuff.c
@@ -355,14 +355,17 @@ void * shm_rdrbuff_sanitize(void * o)
garbage_collect(rdrb);
- if (shm_rdrb_empty(rdrb))
+ if (shm_rdrb_empty(rdrb)) {
+ pthread_cond_broadcast(rdrb->healthy);
continue;
+ }
api = get_tail_ptr(rdrb)->dst_api;
if (kill(api, 0)) {
LOG_DBGF("Dead process %d left stale sdu.", api);
clean_sdus(rdrb, api);
+ pthread_cond_broadcast(rdrb->healthy);
continue;
}
@@ -385,6 +388,7 @@ void * shm_rdrbuff_sanitize(void * o)
clean_sdus(rdrb, api);
}
}
+ pthread_cond_broadcast(rdrb->healthy);
}
pthread_cleanup_pop(true);
@@ -681,7 +685,6 @@ int shm_rdrbuff_remove(struct shm_rdrbuff * rdrb, ssize_t idx)
*rdrb->choked = 0;
pthread_cond_broadcast(rdrb->healthy);
-
pthread_mutex_unlock(rdrb->lock);
return 0;