Call enif_cond_signal from under the mutex instead of outside it