From 277325c39ef85e8e5d9516f62ab07d18132d43d7 Mon Sep 17 00:00:00 2001 From: bernard Date: Fri, 1 Aug 2014 13:25:15 +0800 Subject: [PATCH] [pthreads] fix pthread_cond_init issue when attr is NULL. --- components/pthreads/pthread_cond.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/pthreads/pthread_cond.c b/components/pthreads/pthread_cond.c index e5342dd77..25628fc2b 100644 --- a/components/pthreads/pthread_cond.c +++ b/components/pthreads/pthread_cond.c @@ -98,7 +98,11 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) rt_snprintf(cond_name, sizeof(cond_name), "cond%02d", cond_num++); - cond->attr = *attr; + if (attr == RT_NULL) /* use default value */ + cond->attr = PTHREAD_PROCESS_PRIVATE; + else + cond->attr = *attr; + result = rt_sem_init(&cond->sem, cond_name, 0, RT_IPC_FLAG_FIFO); if (result != RT_EOK) return EINVAL; -- GitLab