pthreads: Fix bug introduced with thread_safe_callbacks