提交 2219c327 编写于 作者: W wangchen

fix: L0 pthread_cond_timedwait接口实现存在的几个问题

【背景】L0 pthread_cond_timedwait接口存在计算溢出

【修改方案】
1,新增abstick 相关修改,先判断再转成32位,避免截断
2,LOS_Event相关函数返回值的处理已存在,无需处理
【影响】
对现有的产品编译不会有影响。

re #I4N9P8
Signed-off-by: Nwangchen <wangchen64@huawei.com>
上级 570f2785
......@@ -229,7 +229,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
const struct timespec *ts)
{
INT32 ret;
UINT32 absTicks;
UINT64 absTicks;
const UINT32 nsPerTick = OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND;
struct timespec tp;
UINT64 nseconds;
......@@ -269,7 +269,8 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
PRINT_ERR("%s: %d failed\n", __FUNCTION__, __LINE__);
}
ret = (INT32)LOS_EventRead(&(cond->event), 0x0f, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, absTicks);
(VOID)LOS_EventClear(&(cond->event), 0);
ret = (INT32)LOS_EventRead(&(cond->event), 0x0f, LOS_WAITMODE_OR | LOS_WAITMODE_CLR, (UINT32)absTicks);
if (pthread_mutex_lock(mutex) != 0) {
PRINT_ERR("%s: %d failed\n", __FUNCTION__, __LINE__);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册