add pthread_cond_destory
authorweiyu <weiyuluo1232@gmail.com>
Mon, 29 Jul 2019 19:44:25 +0000 (12:44 -0700)
committerweiyu <weiyuluo1232@gmail.com>
Mon, 29 Jul 2019 19:44:25 +0000 (12:44 -0700)
include/mypthread.h
pthread.cc

index 20cddb9cf64da03d7c5742c05bf5a5e0b0734aaa..ae5810f664473e9f02c6b2fcb9bd0930ba9b6486 100644 (file)
@@ -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 *);
index d23c4900f6382b62ed39c70c434e852c1e4f22ab..bad6beae1d60c761aac5f3c887700028f838c958 100644 (file)
@@ -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);
+       }
+}