代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/glibc 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From f54e1ddea12343991b402abf28be2b94ffbac2c5 Mon Sep 17 00:00:00 2001
From: Tian Tao <tiantao6@hisilicon.com>
Date: Tue, 11 Jul 2023 08:42:56 +0800
Subject: [PATCH] Optimizing __random for single-threaded scenarios
The __random function does not need to be locked by __libc_lock_lock and
unlocked by __libc_lock_unlock in a single-threaded scenario, so we can
remove these locks in a single-threaded scenario to improve performance.
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
stdlib/random.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/stdlib/random.c b/stdlib/random.c
index 62f22fac8d..9035df8d18 100644
--- a/stdlib/random.c
+++ b/stdlib/random.c
@@ -288,11 +288,19 @@ __random (void)
{
int32_t retval;
- __libc_lock_lock (lock);
+ if (__libc_single_threaded) {
- (void) __random_r (&unsafe_state, &retval);
+ (void) __random_r (&unsafe_state, &retval);
- __libc_lock_unlock (lock);
+ } else {
+
+ __libc_lock_lock (lock);
+
+ (void) __random_r (&unsafe_state, &retval);
+
+ __libc_lock_unlock (lock);
+
+ }
return retval;
}
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。