Skip to contentSkip to conversation

Why does he write such code?

DISCUSSION zhangsong 1 participant 1 message Jan 19, 2009

lore
Share & tools
lore

zhangsong

author
#0 lore raw

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs