From 241f7577895a5c74aad14d9903b6c25ea02e217d Mon Sep 17 00:00:00 2001 From: weiyu Date: Mon, 29 Jul 2019 12:44:25 -0700 Subject: [PATCH] add pthread_cond_destory --- include/mypthread.h | 1 - pthread.cc | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/mypthread.h b/include/mypthread.h index 20cddb9c..ae5810f6 100644 --- a/include/mypthread.h +++ b/include/mypthread.h @@ -44,7 +44,6 @@ int pthread_attr_setscope(pthread_attr_t *, int); int pthread_attr_setstackaddr(pthread_attr_t *, void *); int pthread_attr_setstacksize(pthread_attr_t *, size_t); int pthread_cancel(pthread_t); -int pthread_cond_destroy(pthread_cond_t *); int pthread_condattr_destroy(pthread_condattr_t *); int pthread_condattr_getpshared(const pthread_condattr_t *, int *); int pthread_condattr_init(pthread_condattr_t *); diff --git a/pthread.cc b/pthread.cc index d23c4900..bad6beae 100644 --- a/pthread.cc +++ b/pthread.cc @@ -220,3 +220,13 @@ int pthread_cond_broadcast(pthread_cond_t *p_cond) { v->notify_all(); return 0; } + +int pthread_cond_destroy(pthread_cond_t *p_cond) { + ModelExecution *execution = model->get_execution(); + + if (execution->getCondMap()->contains(p_cond)) { + cdsc::snapcondition_variable *v = execution->getCondMap()->get(p_cond); + delete v; + execution->getCondMap()->remove(p_cond); + } +} -- 2.34.1