2012-11-16 117 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)。

相關問題