代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/perl 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From ecbf46993f6ffbdc255f6ded3c6c05a8266a71e8 Mon Sep 17 00:00:00 2001
From: David Mitchell <davem@iabyn.com>
Date: Tue, 7 Aug 2018 12:26:31 +0100
Subject: [PATCH] Time-HiRes/t/itimer.t: avoid race condition.
This test script sets a repeating interval timer going, and after 4
'ticks' (SIGVTALRM), disables the timer (by setting it to zero).
The main loop which does CPU burning, does a getitmer() every now and
again, and when the value is zero, assumes the signal handler has
disabled the timer, and so finishes.
The trouble was that it was checking the 'time left', which can reach
zero because the interval timer has counted down to zero, and the signal
handler is about to be called, but the interval hasn't been reset back
to 0.4s yet.
i.e. the code doesn't distinguish between "timer disabled" and "timer
just reached zero".
In that scenario, the cleanup code in the test script disables the
SIGVTALRM handler while the timer is still active, and so the process
gets killed if another signal is raised.
This commit changes the test to check the second value returned by
getitmer() for being zero rather than the first - the second being the
repeat interval, whichb is always 0.4 until the timer is disabled.
---
dist/Time-HiRes/t/itimer.t | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dist/Time-HiRes/t/itimer.t b/dist/Time-HiRes/t/itimer.t
index e196b1648c..432b224488 100644
--- a/dist/Time-HiRes/t/itimer.t
+++ b/dist/Time-HiRes/t/itimer.t
@@ -51,7 +51,9 @@ ok(defined $virt && abs($virt / 0.5) - 1 < $limit,
printf("# getitimer: %s\n", join(" ",
Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL)));
-while (Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL)) {
+# burn CPU until the VTALRM signal handler sets the repeat interval to
+# zero, indicating that the timer has fired 4 times.
+while ((Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL))[1]) {
my $j;
for (1..1000) { $j++ } # Can't be unbreakable, must test getitimer().
}
--
2.19.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。