2012-11-16 66 views
0
typedef void (*work_func_t)(struct work_struct *work); 

我在Linux内核源代码中发现typedef,但我不明白。任何人都可以给我一些解释吗?谢谢!这个'typedef'在Linux内核中的含义是什么?

补充:

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 
}; 

从下面的“类型定义”上面的代码,我现在可以理解。 @piokuc是对的,谢谢!

+0

它的函数指针语法 - 谷歌函数指针,如果你还没有遇到过它们之前 – mathematician1975

回答

2

work_func_t是指向一个函数的指针的类型别名,它接受指向struct work_struct的指针,因为它只是参数并且什么也不返回(void)。

相关问题