You can use this to enforce exclusive access to all objects attached to the event loop. This lock is recursive. This function may not be called inside the event loop thread. Events that are dispatched from the event loop thread are executed with this lock held.

You can use this to pass data from the event loop thread to the main thread in a synchronized fashion. This function may not be called inside the event loop thread. Prior to this call the event loop object needs to be locked using pa_threaded_mainloop_lock(). While waiting the lock will be released. Immediately before returning it will be acquired again. This function may spuriously wake up even without pa_threaded_mainloop_signal() being called. You need to make sure to handle that!