Why does he write such code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all, 

I read linux-2.4 and found a line of confused code:

In kernel/sched.c:
       
     void do_timer(struct pt_regs * regs)
     {
  	   (*(unsigned long *)&jiffies)++; /* confused code */
    …
     }

1. Why not to use something link atomic_inc insead of the above code?
2. Can the GCC optimize the above code to jiffies++ ?

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

[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux