Checking the operation state caused a deadlock, because the state
won't change before my_drain_callback() returns, and it doesn't
return before my_drain_stream_func() calls
pa_threaded_mainloop_accept().
* access this data safely, we must extend our example a bit:
*
* \code
- * static int *drain_result;
+ * static volatile int *drain_result = NULL;
*
* static void my_drain_callback(pa_stream*s, int success, void *userdata) {
* pa_threaded_mainloop *m;
* o = pa_stream_drain(s, my_drain_callback, m);
* assert(o);
*
- * while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
+ * while (drain_result == NULL)
* pa_threaded_mainloop_wait(m);
*
* pa_operation_unref(o);