diff options
| author | bernard <[email protected]> | 2014-07-31 08:34:36 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2014-07-31 08:34:36 +0800 |
| commit | 94883a92fbc43b41e4888beb27fc2c3e2a95d4f1 (patch) | |
| tree | a652013e4c417b69e7255c3a1f7295cd43af1c3c /components/pthreads | |
| parent | 0fafa355f39632e81bded1d123927aee0cb6f44a (diff) | |
[pthreads] Fix pthread_cond_init issue. #261
Diffstat (limited to 'components/pthreads')
| -rw-r--r-- | components/pthreads/pthread_cond.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/components/pthreads/pthread_cond.c b/components/pthreads/pthread_cond.c index e5342dd775..25628fc2b3 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; |
