I’m working on a Pango extension for PHP and ran into a race condition that occasionally causes a segfault during PHP process shutdown. From my analysis so far, I see that the issue is related to the asynchronous worker thread started in pangofc-fontmap.c.
Currently I use usleep(50000) as a workaround to wait for the thread, but this is unreliable. Is there a way to:
-
Synchronously wait for the thread to complete
-
Test whether the thread has terminated
-
Properly coordinate shutdown to avoid the race condition
Any guidance on the proper cleanup sequence would be appreciated.
I work against Pango 1.56.3 on Ubuntu 25.10 in a docker container.