>
> This kernel code should do just fine.
>
>
>
> struct INFO {
> struct timer_list timer; // For test timer
> atomic_t running; // Timer is running
> };
>
> //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> //
> // This stops the timer. This must NOT be called with a spin-lock
> // held.
> //
> static void stop_timer()
> {
> if(atomic_read(&info->running))
> {
> atomic_dec(&info->running);
this is a race.
> if(info->timer.function)
> del_timer(&info->timer);
you probably want del_timer_sync() here.
> static void start_timer(void)
> {
> if(!atomic_read(&info->running))
> {
> atomic_inc(&info->running);
same race.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]