[英]What is the meaning of this 'typedef' in 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是對的,謝謝!
work_func_t
是指向函數的指針的類型別名,該函數接受指向struct work_struct
指針,因為它是唯一的參數並且不返回任何內容( void
)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.