]> code.delx.au - pulseaudio/commitdiff
client: fix documentation for threaded mainloop
authorLennart Poettering <lennart@poettering.net>
Fri, 31 Jul 2009 21:07:07 +0000 (23:07 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 31 Jul 2009 21:07:07 +0000 (23:07 +0200)
Closes #553

src/pulse/thread-mainloop.h

index 41159d9898cc17ff0819838a75fdc22846d05b9d..e847070dfae7f69b202a580717987538d64804d5 100644 (file)
@@ -137,15 +137,19 @@ PA_C_DECL_BEGIN
  * The main function, my_drain_stream_func(), will wait for the callback to
  * be called using pa_threaded_mainloop_wait().
  *
- * If your application is multi-threaded, then this waiting must be done
- * inside a while loop. The reason for this is that multiple threads might be
- * using pa_threaded_mainloop_wait() at the same time. Each thread must
- * therefore verify that it was its callback that was invoked.
+ * If your application is multi-threaded, then this waiting must be
+ * done inside a while loop. The reason for this is that multiple
+ * threads might be using pa_threaded_mainloop_wait() at the same
+ * 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
  * 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(),
  * but as the lock is held before the callback is invoked, you do not have to
  * deal with that.