Actually, I think we should never unlock the mutex in these functions - see my comment below for notification_thread_func()