提交 7696a36b 编写于 作者: L li-tao116

Optimize pthread_cond_init

Use __builtin_memset to init pthread_cond_t.

Issue: #I7M851
Test: libctest, benchmark
Signed-off-by: Nlitao <litao@kaihong.com>
Change-Id: Ib30428b82df4eebe7788f88e2638189e5afa1f97
上级 cea704b5
......@@ -2125,6 +2125,7 @@ musl_src_porting_file = [
"src/thread/pthread_cond_timedwait_monotonic_np.c",
"src/thread/pthread_cond_timeout_np.c",
"src/thread/pthread_cond_clockwait.c",
"src/thread/pthread_cond_init.c",
"src/thread/pthread_create.c",
"src/thread/pthread_rwlock_clockwrlock.c",
"src/thread/pthread_rwlock_timedwrlock_monotonic_np.c",
......
#include "pthread_impl.h"
int pthread_cond_init(pthread_cond_t *restrict c, const pthread_condattr_t *restrict a)
{
__builtin_memset(c, 0, sizeof(pthread_cond_t));
if (a) {
c->_c_clock = a->__attr & 0x7fffffff;
if (a->__attr>>31) c->_c_shared = (void *)-1;
}
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册