summaryrefslogtreecommitdiff
path: root/components/libc
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2016-11-08 09:21:32 +0800
committerBernard Xiong <[email protected]>2016-11-08 09:21:32 +0800
commit2d7486fcc02c45690efd4b21943dd2ae02e96014 (patch)
treea1951bc6ceb1e6731feb7a02710488d6a8a7e404 /components/libc
parent712c0673fbe9a5fa6b23f07ff58ea7dbdc6d4347 (diff)
[pthreads] Fix the sem_trywait issue.
Diffstat (limited to 'components/libc')
-rw-r--r--components/libc/pthreads/semaphore.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/components/libc/pthreads/semaphore.c b/components/libc/pthreads/semaphore.c
index ae69e0d1bc..ea6701b1e0 100644
--- a/components/libc/pthreads/semaphore.c
+++ b/components/libc/pthreads/semaphore.c
@@ -85,7 +85,7 @@ static sem_t *posix_sem_find(const char* name)
return iter;
}
}
-
+
return RT_NULL;
}
@@ -334,7 +334,7 @@ int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout)
/* calculate os tick */
tick = clock_time_to_tick(abs_timeout);
-
+
result = rt_sem_take(sem->sem, tick);
if (result == -RT_ETIMEOUT)
{
@@ -362,7 +362,7 @@ int sem_trywait(sem_t *sem)
return -1;
}
- result = rt_sem_take(sem->sem, RT_WAITING_FOREVER);
+ result = rt_sem_take(sem->sem, 0);
if (result == -RT_ETIMEOUT)
{
rt_set_errno(EAGAIN);