This is the wrong way of fixing this bug. kim_library_init() just registers KIM's error tables using a pthread-once call.
I would like to understand the deadlock this patch is intended to fix. There are multiple mutexes involved (one for the error table array and one for KIM's copy of the framework cfbundle). However it's not obvious to me from just looking at the patch what the deadlock is.
I don't see a regression test tagged with this bug number.
This should be fixed by moving the CFBundle code in kim_os_string.c into the support library under non-KIM names. Then this code will no longer call into KIM initializers and cannot deadlock error_message().