lkml.org 
[lkml]   [2022]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] timers: Add del_time_free() to be called before freeing timers
On Fri, 08 Apr 2022 22:29:58 +0200
Thomas Gleixner <tglx@linutronix.de> wrote:

> Well, you'd have to reinitialize it first before the explicit rearm
> because the shutdown cleared the function pointer or if we use a flag
> then the flag would prevent arming it again.

We could always use the LSB bit of the function as a "shutdown" flag, where:

timer_shutdown() {
[..]
timer->fn = (void *)((unsigned long)timer->fn | 1);
[..]
}

timer_rearm() {
[..]
timer->fn = (void *)((unsigned long)timer->fn & ~1UL);
[..]
}

mod_timer() {

if ((unsigned long)timer->fn & 1)
return -EBUSY?;

[..]
}

-- Steve

\
 
 \ /
  Last update: 2022-04-09 02:23    [W:0.226 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site