client: fix documentation for threaded mainloop

Closes #553
This commit is contained in:
Lennart Poettering 2009-07-31 23:07:07 +02:00
parent 66db0c8471
commit 2952f28c06

View file

@ -137,15 +137,19 @@ PA_C_DECL_BEGIN
* The main function, my_drain_stream_func(), will wait for the callback to * The main function, my_drain_stream_func(), will wait for the callback to
* be called using pa_threaded_mainloop_wait(). * be called using pa_threaded_mainloop_wait().
* *
* If your application is multi-threaded, then this waiting must be done * If your application is multi-threaded, then this waiting must be
* inside a while loop. The reason for this is that multiple threads might be * done inside a while loop. The reason for this is that multiple
* using pa_threaded_mainloop_wait() at the same time. Each thread must * threads might be using pa_threaded_mainloop_wait() at the same
* therefore verify that it was its callback that was invoked. * time. Each thread must therefore verify that it was its callback
* that was invoked. Also the underlying OS synchronization primitives
* are usually not free of spurious wake-ups, so a
* pa_threaded_mainloop_wait() must be called within a loop even if
* you have only one thread waiting.
* *
* The callback, my_drain_callback(), indicates to the main function that it * The callback, my_drain_callback(), indicates to the main function that it
* has been called using pa_threaded_mainloop_signal(). * has been called using pa_threaded_mainloop_signal().
* *
* As you can see, both pa_threaded_mainloop_wait() may only be called with * As you can see, pa_threaded_mainloop_wait() may only be called with
* the lock held. The same thing is true for pa_threaded_mainloop_signal(), * the lock held. The same thing is true for pa_threaded_mainloop_signal(),
* but as the lock is held before the callback is invoked, you do not have to * but as the lock is held before the callback is invoked, you do not have to
* deal with that. * deal with that.