Issue 49572 - ns_job_wait race on condvar
Bug description: ns_job_persist_disarm_test were failing
because of a race condition.
Fix description: We need to lock the cb mutex before we arm
the job so the order of operations that happens there is
determined.
First we lock the mutex, then after the rearm it will
disarm it and will wait inside for the mutex unlock.
In a meanwhile, our testing thread will come to cond_wait
and it will unlock the mutex while waiting for the signal.
The mutex inside of callback will be acquired and cb_check will set to 1
and the signal will be sent. After that, cond_wait will be released and
the test will check for the right cb_check value.
https://pagure.io/389-ds-base/issue/49572
Reviewed by: wibrown (Thanks!)