一小段感觉不错的代码

Posted on Dec 25, 2010 06:50:15 AM

声明:是因为我菜,所以感觉好而已。

最近在读《Linux Kernel Development》,在Bottom Halves部分有一段简化了的代码(关于softirq的),如下:(只是感觉用法上很巧妙而已,仅此而已,做个笔记)

 

pending = local_softirq_pending();
if (pending) {
        struct softing_action *h; 

        /* reset the pending bitmask */
        set_softirq_pending(0);

        h = softirq_vec;
        do {
                if (pending & 1)
                        h->action(h);
                h++;
                pending >> 1;
        } while (pending);
}

 

[zz]tagged structure initialization

Posted on Nov 25, 2010 10:42:56 PM


直接贴网址:http://stackoverflow.com/questions/3016107/what-is-tagged-structure-initialization-syntax/3017026#3017026

Read more