diff options
| author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-07-20 16:24:00 +0200 | 
|---|---|---|
| committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-07-20 16:24:00 +0200 | 
| commit | ef67f3f4a808fc6e6484be9ddee06ee6756d8c93 (patch) | |
| tree | 4039be43ac2a3c9dee69abd2b67e7ee934560a2f /src/lib | |
| parent | c2622b4c09271a99c1109c0cdc91cb01ada1aae3 (diff) | |
| parent | 0dacddfff0a705591e6665a00c367c367c23c1f0 (diff) | |
| download | ouroboros-ef67f3f4a808fc6e6484be9ddee06ee6756d8c93.tar.gz ouroboros-ef67f3f4a808fc6e6484be9ddee06ee6756d8c93.zip | |
Merge branch 'testing' into be
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/cdap.c | 19 | 
1 files changed, 11 insertions, 8 deletions
| diff --git a/src/lib/cdap.c b/src/lib/cdap.c index 16f2c078..c1209138 100644 --- a/src/lib/cdap.c +++ b/src/lib/cdap.c @@ -268,7 +268,7 @@ static void cdap_rcvd_destroy(struct cdap * instance)          pthread_mutex_lock(&instance->rcvd_lock); -        list_for_each_safe(p, h, &instance->sent) { +        list_for_each_safe(p, h, &instance->rcvd) {                  struct cdap_rcvd * r = list_entry(p, struct cdap_rcvd, next);                  list_del(&r->next);                  if (r->data != NULL) @@ -578,15 +578,8 @@ int cdap_del_flow(struct cdap * instance,          pthread_rwlock_wrlock(&instance->flows_lock); -        pthread_mutex_lock(&instance->mtx); - -        while (instance->proc) -                pthread_cond_wait(&instance->cond, &instance->mtx); -          flow_set_del(instance->set, fd); -        pthread_mutex_unlock(&instance->mtx); -          list_for_each_safe(p, h, &instance->flows) {                  struct fd_el * e = list_entry(p, struct fd_el, next);                  if (e->fd == fd) { @@ -600,6 +593,16 @@ int cdap_del_flow(struct cdap * instance,          pthread_rwlock_unlock(&instance->flows_lock); +        pthread_mutex_lock(&instance->mtx); + +        pthread_cleanup_push((void(*)(void *))pthread_mutex_unlock, +                             (void *) &instance->mtx); + +        while (instance->proc) +                pthread_cond_wait(&instance->cond, &instance->mtx); + +        pthread_cleanup_pop(true); +          return 0;  } | 
