rework hook list stuff once again: change the callback prototype to recieve three data pointers: one to the data for the hook, once for the slot and once for the call

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1235 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2006-08-13 16:13:36 +00:00
parent 281125c727
commit db3f561ec4
3 changed files with 27 additions and 18 deletions

View file

@ -35,13 +35,16 @@ typedef enum pa_hook_result {
PA_HOOK_CANCEL = -1
} pa_hook_result_t;
typedef pa_hook_result_t (*pa_hook_cb_t)(void *data, void *userdata);
typedef pa_hook_result_t (*pa_hook_cb_t)(
void *hook_data,
void *call_data,
void *slot_data);
struct pa_hook_slot {
int dead;
pa_hook *hook;
pa_hook_cb_t callback;
void *userdata;
void *data;
PA_LLIST_FIELDS(pa_hook_slot);
};
@ -49,12 +52,14 @@ struct pa_hook {
PA_LLIST_HEAD(pa_hook_slot, slots);
pa_hook_slot *last;
int firing, n_dead;
void *data;
};
void pa_hook_init(pa_hook *hook);
void pa_hook_init(pa_hook *hook, void *data);
void pa_hook_free(pa_hook *hook);
pa_hook_slot* pa_hook_connect(pa_hook *hook, pa_hook_cb_t, void *userdata);
pa_hook_slot* pa_hook_connect(pa_hook *hook, pa_hook_cb_t, void *data);
void pa_hook_slot_free(pa_hook_slot *slot);
pa_hook_result_t pa_hook_fire(pa_hook *hook, void *data);