summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2021-06-14 12:57:15 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2021-06-14 12:57:15 +0000
commitf363a38664dc4ea11df2e6c8f5bf7ec249c2064b (patch)
tree4245de85bebdcf49424df8eda76108ca40f622da
parentca59366460d7ca26cfb16aa4a2465f4f2896687b (diff)
downloadVirtualBox-svn-f363a38664dc4ea11df2e6c8f5bf7ec249c2064b.tar.gz
Runtime/r3/timer-posix: Fixes, if inversion causing an already stopped timer to be stopped again causing an error and a running timer to not be stopped at all. Fully initialize itimerspec when stopping a timer or timer_settime will return an error
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@89678 cfe28804-0f27-0410-a406-dd0f0b0b656f
-rw-r--r--src/VBox/Runtime/r3/posix/timer-posix.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/VBox/Runtime/r3/posix/timer-posix.cpp b/src/VBox/Runtime/r3/posix/timer-posix.cpp
index f74ea5fb417..ecc27346dc3 100644
--- a/src/VBox/Runtime/r3/posix/timer-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/timer-posix.cpp
@@ -663,7 +663,7 @@ RTR3DECL(int) RTTimerDestroy(PRTTIMER pTimer)
/*
* Suspend the timer if it's running.
*/
- if (pTimer->fSuspended)
+ if (!pTimer->fSuspended)
{
struct itimerspec TimerSpec;
TimerSpec.it_value.tv_sec = 0;
@@ -812,6 +812,8 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer)
struct itimerspec TimerSpec;
TimerSpec.it_value.tv_sec = 0;
TimerSpec.it_value.tv_nsec = 0;
+ TimerSpec.it_interval.tv_sec = 0;
+ TimerSpec.it_interval.tv_nsec = 0;
int err = timer_settime(pTimer->NativeTimer, 0, &TimerSpec, NULL);
int rc = err == 0 ? VINF_SUCCESS : RTErrConvertFromErrno(errno);
#endif /* IPRT_WITH_POSIX_TIMERS */