The global cache does not have any thread locking. Not sure if the lower level libraries also have similar problems.
I am looking at doing a patch for this. However I am not too sure what would be acceptable. I am proposing to use the macro's contained in the X11 headers and the X11 global mutex, so that the library will end up using the X11 thread support. I'm not particularly happy with this as this could cause a bottle-neck elsewhere in the X11 libraries. I would prefer that each and every library have their own mutex for the library data access however I can't see anyway of configuring a mutex via the X11 initialisation of threads. Any suggestions? The reason I am interested in this is that I want TTF support but my applications are very heavily threaded (15 plus threads all using X11 via different Display connections). As many tool kits use Xft I have no way of coordinating 3rd party use of Xft in a thread safe way. As such my only choice is to push the thread problems into Xft. Thanks Damian
Did you ever get around to a patch Damian?
I never got around to doing a patch. The libraries below Xft such as freetype are not thread safe when used in the way that Xft uses them. You need to open the freetype library for each thread. So it all started to get a bit too complex. It was therefore simpler to take a mutex when I needed to use Xft. It's not the optimal approach. Ideally I would prefer to store the thread data on the Display connection and avoid locking. I just don't know how to do this. This is also not the correct approach as all users of Xft in a process need to lock/unlock the same mutex. This means that interactions between my SDK and say Motif/Qt become a problem for a developer as there is no defined way of ensuring thread safety with Xft text drawing.
Mass closure: This bug has been untouched for more than six years, and is not obviously still valid. Please reopen this bug or file a new report if you continue to experience issues with current releases.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.