这个'typedef'在Linux内核中的含义是什么?

时间:2012-11-16 15:39:01

标签: linux kernel

typedef void (*work_func_t)(struct work_struct *work);

我在Linux内核源代码中找到了上面的typedef,但我不明白。谁能给我一些解释?谢谢!

补:

struct work_struct {
    atomic_long_t data;
#define WORK_STRUCT_PENDING 0       /* T if work item pending execution */
#define WORK_STRUCT_STATIC  1       /* static initializer (debugobjects) */
#define WORK_STRUCT_FLAG_MASK (3UL)
#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
    struct list_head entry;
    work_func_t func;
#ifdef CONFIG_LOCKDEP
    struct lockdep_map lockdep_map;
#endif
};

从上面的“typedef”后面的代码,我现在可以理解了。 @piokuc是对的,谢谢!

1 个答案:

答案 0 :(得分:2)

work_func_t是指向函数的指针的类型别名,该函数接受指向struct work_struct的指针,因为它是唯一的参数并且不返回任何内容(void)。

相关问题