def sync_operation(self, op):
     """Wait for an operation to be done or cancelled, then release it.
     Uses a busy-loop -- make sure a callback is registered to
     signal this listener."""
     while pa.pa_operation_get_state(op) == pa.PA_OPERATION_RUNNING:
         pa.pa_threaded_mainloop_wait(self.threaded_mainloop)
     pa.pa_operation_unref(op)
 def async_operation(self, op):
     """Release the operation immediately without waiting for it to
     complete."""
     pa.pa_operation_unref(op)