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 20cddb9..ae5810f 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_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 *);
 int pthread_condattr_destroy(pthread_condattr_t *);
 int pthread_condattr_getpshared(const pthread_condattr_t *, int *);
 int pthread_condattr_init(pthread_condattr_t *);
index d23c490..bad6bea 100644 (file)
@@ -220,3 +220,13 @@ int pthread_cond_broadcast(pthread_cond_t *p_cond) {
        v->notify_all();
        return 0;
 }
        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);
+       }
+}