Cygwin: posix timers: fix resource leak

On setting the timer, the thread is accidentally only canceled when
disarming the timer.  This leaks one thread per timer_settimer call.
Move the thread cancellation where it belongs.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2019-03-06 22:17:32 +01:00
parent 633278b877
commit 094a2a17ad
2 changed files with 14 additions and 1 deletions

View File

@ -287,9 +287,9 @@ timer_tracker::settime (int flags, const itimerspec *new_value,
if (old_value)
gettime (old_value, false);
cancel ();
if (!new_value->it_value.tv_sec && !new_value->it_value.tv_nsec)
{
cancel ();
memset (&time_spec, 0, sizeof time_spec);
interval = 0;
exp_ts = 0;