fix: L0 pthread_cond_timedwait接口实现存在的几个问题
【背景】L0 pthread_cond_timedwait接口存在计算溢出 【修改方案】 1,新增abstick 相关修改,先判断再转成32位,避免截断 2,LOS_Event相关函数返回值的处理已存在,无需处理 【影响】 对现有的产品编译不会有影响。 re #I4N9P8 Signed-off-by: wangchen <wangchen64@huawei.com>
This commit is contained in:
parent
570f2785bd
commit
2219c32784
|
@ -229,7 +229,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||||
const struct timespec *ts)
|
const struct timespec *ts)
|
||||||
{
|
{
|
||||||
INT32 ret;
|
INT32 ret;
|
||||||
UINT32 absTicks;
|
UINT64 absTicks;
|
||||||
const UINT32 nsPerTick = OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND;
|
const UINT32 nsPerTick = OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND;
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
UINT64 nseconds;
|
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__);
|
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) {
|
if (pthread_mutex_lock(mutex) != 0) {
|
||||||
PRINT_ERR("%s: %d failed\n", __FUNCTION__, __LINE__);
|
PRINT_ERR("%s: %d failed\n", __FUNCTION__, __LINE__);
|
||||||
|
|
Loading…
Reference in New Issue