diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-09-14 21:51:05 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-09-14 21:51:05 +0000 |
commit | 3396b65f15a06ff312e318bc05e502ba402c564e (patch) | |
tree | 5087148cbe36f765f9fff99528d812c198799c63 /src/pulsecore/rtpoll.h | |
parent | f0b9dce32e4c5d77f57364ccdc7795f828f7f6a0 (diff) |
simplify rt loops a bit by moving more code into pa_rtpoll. It is now possible to attach "work" functions to a pa_rtpoll_item, which will be called in each loop iteration. This allows us to hide the message processing in the RT loops and to drop the seperate sink_input->process hooks. Basically, only the driver-specific code remains in the RT loops.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1822 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/rtpoll.h')
-rw-r--r-- | src/pulsecore/rtpoll.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/pulsecore/rtpoll.h b/src/pulsecore/rtpoll.h index bef9eedb..9a368d36 100644 --- a/src/pulsecore/rtpoll.h +++ b/src/pulsecore/rtpoll.h @@ -69,7 +69,9 @@ void pa_rtpoll_install(pa_rtpoll *p); /* Sleep on the rtpoll until the time event, or any of the fd events * is triggered. If "wait" is 0 we don't sleep but only update the - * struct pollfd. */ + * struct pollfd. Returns negative on error, positive if the loop + * should continue to run, 0 when the loop should be terminated + * cleanly. */ int pa_rtpoll_run(pa_rtpoll *f, int wait); void pa_rtpoll_set_timer_absolute(pa_rtpoll *p, const struct timespec *ts); @@ -86,18 +88,30 @@ void pa_rtpoll_item_free(pa_rtpoll_item *i); * using the pointer and don't save the result anywhere */ struct pollfd *pa_rtpoll_item_get_pollfd(pa_rtpoll_item *i, unsigned *n_fds); +/* Set the callback that shall be called when there's time to do some work: If the + * callback returns a value > 0, the poll is skipped and the next + * iteraton of the loop will start immediately. */ +void pa_rtpoll_item_set_work_callback(pa_rtpoll_item *i, int (*work_cb)(pa_rtpoll_item *i)); + /* Set the callback that shall be called immediately before entering - * the sleeping poll: If the callback returns a negative value, the - * poll is skipped. */ + * the sleeping poll: If the callback returns a value > 0, the poll is + * skipped and the next iteraton of the loop will start + * immediately.. */ void pa_rtpoll_item_set_before_callback(pa_rtpoll_item *i, int (*before_cb)(pa_rtpoll_item *i)); /* Set the callback that shall be called immediately after having * entered the sleeping poll */ void pa_rtpoll_item_set_after_callback(pa_rtpoll_item *i, void (*after_cb)(pa_rtpoll_item *i)); + + void pa_rtpoll_item_set_userdata(pa_rtpoll_item *i, void *userdata); void* pa_rtpoll_item_get_userdata(pa_rtpoll_item *i); pa_rtpoll_item *pa_rtpoll_item_new_fdsem(pa_rtpoll *p, pa_rtpoll_priority_t prio, pa_fdsem *s); pa_rtpoll_item *pa_rtpoll_item_new_asyncmsgq(pa_rtpoll *p, pa_rtpoll_priority_t prio, pa_asyncmsgq *q); +/* Requests the loop to exit. Will cause the next iteration of + * pa_rtpoll_run() to return 0 */ +void pa_rtpoll_quit(pa_rtpoll *p); + #endif |