id	summary	reporter	owner	description	type	status	milestone	component	resolution	keywords	cc
799	libpulse use of Xlib is not thread-safe	courmisch	lennart	"As specified by the Xlib documentation, XInitThreads() '''must''' be invoked before any other Xlib call in a multi-thread program. Alternatively, all Xlib calls shall be protected by some synchronization mechanism, such as a global Xlib use lock.

libpulse uses Xlib but does not call XInitThreads(). This compromises the thread-safety of any process using libpulse in the likely case that Xlib is also used from another thread. This is qutie common for multimedia frameworks with the audio pipeline in one thread and the video pipeline in another.

Unfortunately, I cannot find an easy fix for this issue. libpulse should probably not call XInitThreads(). This would cause problems in a non-threaded program that initializes Xlib before libpulse. Then libpulse would call XInitThreads() while Xlib is already initialized in non-threaded mode, which is invalid.

Since libpulse does a fairly minimal use of X11, using XCB instead of Xlib might be a more reasonable option. That would get rid of the problem."	defect	new		module-x11-*			
