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 是对的,谢谢!
最佳答案
work_func_t
是指向函数的指针的类型别名,该函数接受指向 struct work_struct
的指针,因为它只是参数并且不返回任何内容(void
).
关于linux - Linux内核中这个 'typedef'是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13419738/