Re: timer functions

george anzinger (george@mvista.com)
Tue, 31 Jul 2001 23:39:01 -0700


sebastien person wrote:
>
> Hi,
>
> I have a problem using timers. :-(
>
> I want to change the function called by the timer :
> - the first call on the first function works fine
> - but the second call wich change the function being called
> give me following error message : "bug: kernel timer added twice at c88cbdd7"
> and the linux box hang totally
>
> Is it possible to changed the called function ?
>
> Any ideas ?
>
> thanks
>
> sebastien person
If I understand it, you have an active timer and want to change the
function it calls.

If the timer is close to expiring, you may have a race with that, but,
in any case, you should be able to just change the function pointer in
the timer structure. If you are too late, you will find the timer is
free (test by looking for NULL in the list pointer). The system does
not use or look at the function pointer until it is about to make the
call, i.e. when the timer expires. You do not have to call any timer
routine to do this, though many would say it is not good practice.

George
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/