summaryrefslogtreecommitdiff
path: root/src/lib/cdap_req.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-04-01 10:04:59 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-04-01 10:04:59 +0000
commitd9f3619d791fef7d79127556304a4aa4f1cda50a (patch)
treeefd58bca3a7c0d2302bbc9c9eaffa1d0dc95ad89 /src/lib/cdap_req.c
parentd9d3d3010511a1893e5fffdfbc5378db59233a1e (diff)
parentd426058a82137d3186a245b0548a262fbd35761b (diff)
downloadouroboros-d9f3619d791fef7d79127556304a4aa4f1cda50a.tar.gz
ouroboros-d9f3619d791fef7d79127556304a4aa4f1cda50a.zip
Merged in dstaesse/ouroboros/be-fixes (pull request #447)
Be fixes
Diffstat (limited to 'src/lib/cdap_req.c')
-rw-r--r--src/lib/cdap_req.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/cdap_req.c b/src/lib/cdap_req.c
index df748058..4eab6fa6 100644
--- a/src/lib/cdap_req.c
+++ b/src/lib/cdap_req.c
@@ -76,6 +76,7 @@ void cdap_req_destroy(struct cdap_req * creq)
creq->state = REQ_NULL;
pthread_cond_broadcast(&creq->cond);
break;
+ case REQ_INIT_PENDING:
case REQ_PENDING:
case REQ_RESPONSE:
creq->state = REQ_DESTROY;
@@ -151,7 +152,10 @@ void cdap_req_respond(struct cdap_req * creq,
pthread_mutex_lock(&creq->lock);
- while (creq->state == REQ_INIT)
+ if (creq->state == REQ_INIT)
+ creq->state = REQ_INIT_PENDING;
+
+ while (creq->state == REQ_INIT_PENDING)
pthread_cond_wait(&creq->cond, &creq->lock);
if (creq->state != REQ_PENDING) {