typedef void (*work_func_t)(struct work_struct *work);
I found above typedef in Linux kernel source code, but I don't understand it. Can anyone give me some explaination? Thanks!
Complement:
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
};
From the above code which follows the "typedef", I could understand it now. @piokuc is right, thanks!
work_func_t
是指向函数的指针的类型别名,该函数接受指向struct work_struct
指针,因为它是唯一的参数并且不返回任何内容( void
)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.